Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the parse_attributes method to use Source#match to parse XML. #119

Merged
merged 2 commits into from
Mar 18, 2024

Commits on Mar 15, 2024

  1. Configuration menu
    Copy the full SHA
    7d00e7c View commit details
    Browse the repository at this point in the history
  2. Optimize the parse_attributes method to use Source#match to parse XML.

    ## Why?
    
    Improve maintainability by consolidating processing into `Source#match`.
    
    ## [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     10.891      10.622        16.356       17.403 i/s -     100.000 times in 9.182130s 9.414177s 6.113806s 5.746133s
                     sax     30.335      29.845        49.749       54.877 i/s -     100.000 times in 3.296483s 3.350595s 2.010071s 1.822259s
                    pull     35.514      34.801        61.123       66.908 i/s -     100.000 times in 2.815793s 2.873484s 1.636041s 1.494591s
                  stream     35.141      34.475        52.110       56.836 i/s -     100.000 times in 2.845646s 2.900638s 1.919017s 1.759456s
    
    Comparison:
                                  dom
             after(YJIT):        17.4 i/s
            before(YJIT):        16.4 i/s - 1.06x  slower
                  before:        10.9 i/s - 1.60x  slower
                   after:        10.6 i/s - 1.64x  slower
    
                                  sax
             after(YJIT):        54.9 i/s
            before(YJIT):        49.7 i/s - 1.10x  slower
                  before:        30.3 i/s - 1.81x  slower
                   after:        29.8 i/s - 1.84x  slower
    
                                 pull
             after(YJIT):        66.9 i/s
            before(YJIT):        61.1 i/s - 1.09x  slower
                  before:        35.5 i/s - 1.88x  slower
                   after:        34.8 i/s - 1.92x  slower
    
                               stream
             after(YJIT):        56.8 i/s
            before(YJIT):        52.1 i/s - 1.09x  slower
                  before:        35.1 i/s - 1.62x  slower
                   after:        34.5 i/s - 1.65x  slower
    
    ```
    
    - YJIT=ON : 1.06x - 1.10x faster
    - YJIT=OFF : 0.97x - 0.98x faster
    naitoh committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    a94c5b6 View commit details
    Browse the repository at this point in the history