From d5e59c38acfe39f43de680def19c53c4f12c0088 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 29 Apr 2014 13:47:55 +0200 Subject: [PATCH] Profiling setup for the DOM parser. --- .gitignore | 2 +- profile/parser/big_xml.rb | 8 ++++++++ profile/plot/parser/big_xml.gnuplot | 20 ++++++++++++++++++++ profile/samples/parser/.gitkeep | 0 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 profile/parser/big_xml.rb create mode 100755 profile/plot/parser/big_xml.gnuplot create mode 100644 profile/samples/parser/.gitkeep diff --git a/.gitignore b/.gitignore index 92805d5..a165c71 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ lib/oga/xml/parser.rb benchmark/fixtures/big.xml profile/samples/*.txt -profile/samples/lexer/*.txt +profile/samples/*/*.txt diff --git a/profile/parser/big_xml.rb b/profile/parser/big_xml.rb new file mode 100644 index 0000000..4baea58 --- /dev/null +++ b/profile/parser/big_xml.rb @@ -0,0 +1,8 @@ +require_relative '../profile_helper' + +xml = read_big_xml +parser = Oga::XML::Parser.new(xml) + +profile_memory('parser/big_xml') + +parser.parse diff --git a/profile/plot/parser/big_xml.gnuplot b/profile/plot/parser/big_xml.gnuplot new file mode 100755 index 0000000..a836605 --- /dev/null +++ b/profile/plot/parser/big_xml.gnuplot @@ -0,0 +1,20 @@ +#!/usr/bin/env gnuplot + +set title "DOM parsing 10MB of XML" + +set xlabel "Sample" +set ylabel "Memory (MB)" + +set yrange [0:*] + +set term qt persist size 900,600 +set grid + +set style line 1 lc rgb "#0060ad" lt 1 lw 2 pt 7 ps 1 + +plot "profile/samples/parser/big_xml.txt" \ + using 0:($1 / 1024 ** 2) \ + with linespoints ls 1 \ + title "Memory" + +# vim: set ft=gnuplot: diff --git a/profile/samples/parser/.gitkeep b/profile/samples/parser/.gitkeep new file mode 100644 index 0000000..e69de29