Commit Graph

56 Commits

Author SHA1 Message Date
Yorick Peterse 46f3ec9df5 Configurable samples in the concurrent xpath bench 2015-08-19 13:34:41 +02:00
Yorick Peterse 4f94d03a85 Improved NodeSet performance by a factor of 50
This change is broken up in to two parts:

1. Using a Hash to track if a node is already in a NodeSet
2. Only calling take_ownership when an owner is set

== Using a Hash

Previously various methods such as NodeSet#push and NodeSet#unshift
would call Array#include? (on the internal "nodes" Array) to see if a
node is already present in the set. This is quite problematic
performance wise, especially for large NodeSets. In fact, for the
attached benchmark the vast majority of the time was spent in
Array#include? calls.

Because a NodeSet demands ordering of nodes and must be able to access
them by index (something Set can't do without relying on Enumerable), a
Hash is used to separately keep track of what nodes are in a NodeSet.
This means that checking the presence of a node is simply a matter of
checking a Hash key's presence.

== Calling take_ownership

The if-check for the "owner" variable has been moved out of the
"take_ownership" method and into the methods that call "take_ownership".
This ensures the method isn't called in the first place if no owner is
present, at the cost of slightly more code repetition. The same applies
to the "remove_ownership" method.

== Conclusion

The combined result is a speedup of about 50x when running the attached
concurrent_time_bench.rb benchmark.
2015-08-19 01:36:37 +02:00
Yorick Peterse 4ba9af4f74 Fixed oga requires for benchmarking/profiling 2015-08-19 01:27:01 +02:00
Yorick Peterse b8415b7376 Revert "Removed bundler/setup requires"
This reverts commit ed9ead4fc0.
2015-08-19 01:26:03 +02:00
Yorick Peterse f5dae24c39 Added ips benchmark for NodeSet#push 2015-08-19 01:20:27 +02:00
Yorick Peterse ed9ead4fc0 Removed bundler/setup requires
This allows loading of any other Gems (e.g. when testing things out)
without having to add them to the Gemspec/Gemfile.
2015-08-18 22:48:00 +02:00
Yorick Peterse 4346cc6ec3 Added a KAF fixture file
This is an output document from one of the components of the
OpeNER (http://www.opener-project.eu/) project.
2015-08-18 22:32:57 +02:00
Yorick Peterse 4bfeea2590 Use require vs require_relative
See ruby-ll commit b27fe7cc109a39184ac984405a1e452868f3fac9 for a more
in-depth explanation of this.
2015-06-03 06:42:30 +02:00
Yorick Peterse 04f431eee7 Add HTML lexer large input timing benchmark 2015-05-23 06:54:15 +02:00
Yorick Peterse ce10ac779d Move HTML lexer benchmarks to a separate directory 2015-05-23 06:53:11 +02:00
Yorick Peterse 73855e6428 Compare with Nokogiri in the HTML parser bench 2015-05-21 20:59:48 +02:00
Yorick Peterse 361374c813 IPS benchmark for XPath::Evaluator#node_matches? 2015-05-07 00:04:40 +02:00
Yorick Peterse 235180e821 Added benchmarks for Traversal#each_node 2015-04-12 22:34:53 +02:00
Yorick Peterse e6d2ba4e0e Warm up caches in the XPath big XML benchmark 2015-04-12 20:25:21 +02:00
Yorick Peterse 602e231840 XPath benchmark for querying large XML documents 2015-03-31 22:17:48 +02:00
Yorick Peterse 2c4e490614 Added CSS/XPath Parser.parse_with_cache
This method parses and caches ASTs using Oga::LRU. Currently the default
of 1024 keys is used.

See #71 for more information.
2015-03-23 00:22:59 +01:00
Yorick Peterse 3bb67ddf28 XPath evaluation bench to test parsing times
This benchmark is simple enough that the overhead of evaluation is not
far greater than parsing. This makes it suitable for benchmarking the
performance increase of caching XPath ASTs.
2015-03-22 18:31:42 +01:00
Yorick Peterse 7409257702 Replaced HTML benchmark fixtures.
The new fixture is the HTML of a person article which contains a few HTML
entities.
2015-03-05 22:58:22 +01:00
Yorick Peterse c68b038e53 Added benchmark for the CSS parser. 2015-02-13 09:36:24 +01:00
Yorick Peterse 19e9834583 Compare XPath benchmark blocks. 2014-11-13 01:18:16 +01:00
Yorick Peterse 47e4a3aa49 Added benchmark for descendant-or-self 2014-10-23 01:11:19 +02:00
Yorick Peterse c89ac91f3a Benchmark for lexing HTML void elements. 2014-09-24 10:43:49 +02:00
Yorick Peterse d004bc7233 Use advance vs lex in the HTML lexer bench. 2014-09-24 10:07:14 +02:00
Yorick Peterse d92133ef43 Benchmark Oga XPath evaluation without the parser.
This gives better insight in the performance of the evaluator itself.
2014-09-02 20:55:42 +02:00
Yorick Peterse 84d6ba96c2 Benchmarks for comparing Oga with others.
This includes two benchmarks: one for parsing XML and one for evaluating XPath.
2014-09-02 20:45:23 +02:00
Yorick Peterse 3dcd0e4584 Compare results of the XML pull parser benchmark. 2014-09-02 10:06:09 +02:00
Yorick Peterse adb125c647 Compare results of the XML parser benchmark. 2014-09-02 10:05:11 +02:00
Yorick Peterse aad9279048 Removed a useless XML parser benchmark. 2014-09-02 10:04:20 +02:00
Yorick Peterse 69f1cd0a40 Compare results of the lexer benchmark. 2014-09-02 10:03:41 +02:00
Yorick Peterse 8bab5c70d8 Removed two useless XML lexer benchmarks. 2014-09-02 10:03:30 +02:00
Yorick Peterse 9bda9dac19 Basic benchmark for the XPath parser. 2014-06-23 20:50:07 +02:00
Yorick Peterse 5259c31b36 Re-organized/cleaned up the benchmarks directory. 2014-06-23 20:49:11 +02:00
Yorick Peterse 99615d72f9 Simple benchmarks for the XPath lexer. 2014-06-13 00:49:24 +02:00
Yorick Peterse 61d553be34 Namespaced benchmarks per parser category. 2014-06-13 00:25:39 +02:00
Yorick Peterse c81c6db74e Benchmarks/profilers for IO inputs in the lexer. 2014-05-26 00:31:15 +02:00
Yorick Peterse 854936f30b Added average benchmarks for the parser. 2014-05-16 16:38:27 +02:00
Yorick Peterse e54d77fc2f Cleaned up the average timing benchmark. 2014-05-01 13:43:33 +02:00
Yorick Peterse 203aea6b1a Cleaned up benchmarking code. 2014-05-01 13:08:44 +02:00
Yorick Peterse ebf9099f0e Dropped the benchmark_ prefixes.
These files reside in a benchmark/ directory. Gee, I wonder what they do.
2014-05-01 13:03:21 +02:00
Yorick Peterse 20f2f256f6 Benchmark for measuring average lexing times. 2014-05-01 13:01:52 +02:00
Yorick Peterse e26d5a8664 Removed unused variable in a lexer benchmark. 2014-05-01 12:25:49 +02:00
Yorick Peterse 2f36692abe Fixed the big XML lexer benchmark. 2014-04-30 09:28:28 +02:00
Yorick Peterse 579c0499ed Benchmark for the pull parser. 2014-04-29 14:48:43 +02:00
Yorick Peterse 5ed09236f9 Big XML benchmark for the lexer. 2014-04-29 14:48:36 +02:00
Yorick Peterse a1e9e74b9c Updated a benchmark description. 2014-04-29 14:24:33 +02:00
Yorick Peterse a111e673cb Changed the big XML file size to 10 MB.
This makes various calculations a bit easier opposed to when the file is 11MB
in size.
2014-04-29 13:42:02 +02:00
Yorick Peterse 70fcc8534c Benchmark for parsing big XML documents. 2014-04-29 13:05:45 +02:00
Yorick Peterse c8c9da2922 Track the XML fixture in Git.
To make running benchmarks easier we'll track the XML file in Git in its
compressed form. I also decreased the size of the XML file from ~50 MB to
~10MB.
2014-04-19 01:03:14 +02:00
Yorick Peterse 6f1ce17b31 Benchmark for lexer lines/second.
This benchmark uses a fixture file that is automatically downloaded.
2014-04-17 20:06:24 +02:00
Yorick Peterse 144c95cbb4 Replaced the HRS fixture with one from Gist.
The HRS output is invalid, which Oga can not handle at this time.
2014-04-10 21:31:01 +02:00