-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed processing in REXML::Parsers::BaseParser#pull_event from regu…
…lar expression to processing using StringScanner. ## Why Improve maintainability by optimizing the process so that the parsing process proceeds using StringScanner#scan. # Changed - Added read_source option to IOSource#match to suppress read from @source. - Added Source#string= method for error message output. ## 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.278 11.371 17.346 18.248 i/s - 100.000 times in 8.866784s 8.794635s 5.764884s 5.479904s sax 31.845 32.282 48.621 53.235 i/s - 100.000 times in 3.140243s 3.097687s 2.056704s 1.878479s pull 37.033 37.840 59.401 64.111 i/s - 100.000 times in 2.700312s 2.642690s 1.683465s 1.559796s stream 34.799 36.514 49.432 56.885 i/s - 100.000 times in 2.873632s 2.738665s 2.022967s 1.757948s Comparison: dom after(YJIT): 18.2 i/s before(YJIT): 17.3 i/s - 1.05x slower after: 11.4 i/s - 1.60x slower before: 11.3 i/s - 1.62x slower sax after(YJIT): 53.2 i/s before(YJIT): 48.6 i/s - 1.09x slower after: 32.3 i/s - 1.65x slower before: 31.8 i/s - 1.67x slower pull after(YJIT): 64.1 i/s before(YJIT): 59.4 i/s - 1.08x slower after: 37.8 i/s - 1.69x slower before: 37.0 i/s - 1.73x slower stream after(YJIT): 56.9 i/s before(YJIT): 49.4 i/s - 1.15x slower after: 36.5 i/s - 1.56x slower before: 34.8 i/s - 1.63x slower ``` - YJIT=ON : 1.05x - 1.15x faster - YJIT=OFF : 1.00x - 1.05x faster
- Loading branch information
Showing
2 changed files
with
96 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters