Skip to content

Commit 34cca4c

Browse files
committed
Add XPath //a Benchmark
## Benchmark (Comparison with rexml 3.4.1) ``` $ benchmark-driver benchmark/xpath.yaml Calculating ------------------------------------- rexml 3.4.1 master 3.4.1(YJIT) master(YJIT) //a 28.089 306.852 28.542 371.572 i/s - 100.000 times in 3.560086s 0.325890s 3.503567s 0.269127s Comparison: //a master(YJIT): 371.6 i/s master: 306.9 i/s - 1.21x slower 3.4.1(YJIT): 28.5 i/s - 13.02x slower rexml 3.4.1: 28.1 i/s - 13.23x slower ``` - YJIT=ON : 13.02x faster - YJIT=OFF : 10.92x faster
1 parent 8f43af5 commit 34cca4c

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

benchmark/xpath.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
loop_count: 100
2+
contexts:
3+
- gems:
4+
rexml: 3.2.6
5+
require: false
6+
prelude: require 'rexml'
7+
- name: master
8+
prelude: |
9+
$LOAD_PATH.unshift(File.expand_path("lib"))
10+
require 'rexml'
11+
- name: 3.2.6(YJIT)
12+
gems:
13+
rexml: 3.2.6
14+
require: false
15+
prelude: |
16+
require 'rexml'
17+
RubyVM::YJIT.enable
18+
- name: master(YJIT)
19+
prelude: |
20+
$LOAD_PATH.unshift(File.expand_path("lib"))
21+
require 'rexml'
22+
RubyVM::YJIT.enable
23+
24+
prelude: |
25+
require 'rexml/document'
26+
27+
DIPTH = 100
28+
xml = '<a>' * DIPTH + '<a/>' + '</a>' * DIPTH
29+
doc = REXML::Document.new(xml)
30+
31+
benchmark:
32+
'//a' : REXML::XPath.match(doc, '//a')

0 commit comments

Comments
 (0)