Commit Graph

14 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 361374c813 IPS benchmark for XPath::Evaluator#node_matches? 2015-05-07 00:04:40 +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 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 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 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