Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change loop in parse_attributes to
while true
. (#109)
## Why loop is slower than `while true`. ## Benchmark ``` RUBYLIB= BUNDLER_ORIG_RUBYLIB= /Users/naitoh/.rbenv/versions/3.3.0/bin/ruby -v -S benchmark-driver /Users/naitoh/ghq/github.com/naitoh/rexml/benchmark/parse.yaml ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22] Calculating ------------------------------------- before after before(YJIT) after(YJIT) dom 11.186 11.304 17.395 17.450 i/s - 100.000 times in 8.940144s 8.846590s 5.748718s 5.730793s sax 30.811 31.629 47.352 48.040 i/s - 100.000 times in 3.245601s 3.161619s 2.111854s 2.081594s pull 35.793 36.621 56.924 57.313 i/s - 100.000 times in 2.793829s 2.730693s 1.756732s 1.744812s stream 33.157 34.757 46.792 50.536 i/s - 100.000 times in 3.015940s 2.877088s 2.137106s 1.978787s Comparison: dom after(YJIT): 17.4 i/s before(YJIT): 17.4 i/s - 1.00x slower after: 11.3 i/s - 1.54x slower before: 11.2 i/s - 1.56x slower sax after(YJIT): 48.0 i/s before(YJIT): 47.4 i/s - 1.01x slower after: 31.6 i/s - 1.52x slower before: 30.8 i/s - 1.56x slower pull after(YJIT): 57.3 i/s before(YJIT): 56.9 i/s - 1.01x slower after: 36.6 i/s - 1.57x slower before: 35.8 i/s - 1.60x slower stream after(YJIT): 50.5 i/s before(YJIT): 46.8 i/s - 1.08x slower after: 34.8 i/s - 1.45x slower before: 33.2 i/s - 1.52x slower ``` - YJIT=ON : 1.00x - 1.08x faster - YJIT=OFF : 1.01x - 1.04x faster
- Loading branch information