Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Why] StringScanner.new() instances can be reused within parse_attributes, reducing initialization costs. ## 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.025 11.202 16.207 17.315 i/s - 100.000 times in 9.069926s 8.926851s 6.170348s 5.775288s sax 30.084 30.519 45.220 47.814 i/s - 100.000 times in 3.324024s 3.276648s 2.211399s 2.091429s pull 34.782 35.849 53.867 56.851 i/s - 100.000 times in 2.875069s 2.789495s 1.856439s 1.758998s stream 32.546 33.541 46.362 47.775 i/s - 100.000 times in 3.072603s 2.981465s 2.156952s 2.093130s Comparison: dom after(YJIT): 17.3 i/s before(YJIT): 16.2 i/s - 1.07x slower after: 11.2 i/s - 1.55x slower before: 11.0 i/s - 1.57x slower sax after(YJIT): 47.8 i/s before(YJIT): 45.2 i/s - 1.06x slower after: 30.5 i/s - 1.57x slower before: 30.1 i/s - 1.59x slower pull after(YJIT): 56.9 i/s before(YJIT): 53.9 i/s - 1.06x slower after: 35.8 i/s - 1.59x slower before: 34.8 i/s - 1.63x slower stream after(YJIT): 47.8 i/s before(YJIT): 46.4 i/s - 1.03x slower after: 33.5 i/s - 1.42x slower before: 32.5 i/s - 1.47x slower ``` - YJIT=ON : 1.03x - 1.07x faster - YJIT=OFF : 1.01x - 1.03x faster
- Loading branch information