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

Fixup benchmark and speedup a little, fixes #141 #171

Merged
merged 6 commits into from Feb 25, 2022

Conversation

ojab
Copy link
Contributor

@ojab ojab commented Feb 18, 2022

With README.md from this repo:
1ee03a8 Fix benchmark, switch it to benchmark-ips and add xml + Node#to_html

input size = 9206 bytes

Warming up --------------------------------------
           redcarpet     1.998k i/100ms
commonmarker with to_html
                       652.000  i/100ms
commonmarker with to_xml
                       651.000  i/100ms
commonmarker with ruby HtmlRenderer
                       140.000  i/100ms
commonmarker with render_doc.to_html
                         1.021k i/100ms
            kramdown    17.000  i/100ms
Calculating -------------------------------------
           redcarpet     21.305k (± 1.5%) i/s -    107.892k in   5.065176s
commonmarker with to_html
                          6.127k (± 3.9%) i/s -     30.644k in   5.009868s
commonmarker with to_xml
                          5.775k (± 3.9%) i/s -     29.295k in   5.080767s
commonmarker with ruby HtmlRenderer
                          1.278k (± 6.1%) i/s -      6.440k in   5.057872s
commonmarker with render_doc.to_html
                          9.606k (±11.4%) i/s -     47.987k in   5.052644s
            kramdown    154.707  (± 5.8%) i/s -    782.000  in   5.075266s

Comparison:
           redcarpet:    21305.5 i/s
commonmarker with render_doc.to_html:     9606.0 i/s - 2.22x  (± 0.00) slower
commonmarker with to_html:     6126.7 i/s - 3.48x  (± 0.00) slower
commonmarker with to_xml:     5774.8 i/s - 3.69x  (± 0.00) slower
commonmarker with ruby HtmlRenderer:     1278.3 i/s - 16.67x  (± 0.00) slower
            kramdown:      154.7 i/s - 137.72x  (± 0.00) slower

272a721 Use default allocator for parser and rewrite creation a bit

input size = 9206 bytes

Warming up --------------------------------------
           redcarpet     1.915k i/100ms
commonmarker with to_html
                         1.197k i/100ms
commonmarker with to_xml
                         1.213k i/100ms
commonmarker with ruby HtmlRenderer
                       131.000  i/100ms
commonmarker with render_doc.to_html
                       989.000  i/100ms
            kramdown    16.000  i/100ms
Calculating -------------------------------------
           redcarpet     20.021k (± 1.7%) i/s -    101.495k in   5.070895s
commonmarker with to_html
                         11.790k (± 7.5%) i/s -     58.653k in   5.007325s
commonmarker with to_xml
                         11.386k (± 5.9%) i/s -     57.011k in   5.027840s
commonmarker with ruby HtmlRenderer
                          1.254k (± 5.8%) i/s -      6.288k in   5.036073s
commonmarker with render_doc.to_html
                          9.469k (±11.9%) i/s -     47.472k in   5.078444s
            kramdown    138.965  (±10.1%) i/s -    688.000  in   5.006044s

Comparison:
           redcarpet:    20021.4 i/s
commonmarker with to_html:    11789.7 i/s - 1.70x  (± 0.00) slower
commonmarker with to_xml:    11385.7 i/s - 1.76x  (± 0.00) slower
commonmarker with render_doc.to_html:     9468.7 i/s - 2.11x  (± 0.00) slower
commonmarker with ruby HtmlRenderer:     1254.0 i/s - 15.97x  (± 0.00) slower
            kramdown:      139.0 i/s - 144.08x  (± 0.00) slower

936e91017f65aaade3d5894d02623d1a1f816347 Rework rb_markdown_to_html

input size = 9206 bytes

Warming up --------------------------------------
           redcarpet     1.727k i/100ms
commonmarker with to_html
                         1.010k i/100ms
commonmarker with to_xml
                         1.050k i/100ms
commonmarker with ruby HtmlRenderer
                       115.000  i/100ms
commonmarker with render_doc.to_html
                       760.000  i/100ms
            kramdown    12.000  i/100ms
Calculating -------------------------------------
           redcarpet     16.851k (± 9.5%) i/s -     84.623k in   5.078071s
commonmarker with to_html
                         10.699k (± 4.0%) i/s -     53.530k in   5.011280s
commonmarker with to_xml
                         10.413k (± 4.0%) i/s -     52.500k in   5.050548s
commonmarker with ruby HtmlRenderer
                          1.134k (± 2.8%) i/s -      5.750k in   5.075396s
commonmarker with render_doc.to_html
                          8.896k (±11.2%) i/s -     44.080k in   5.023672s
            kramdown    145.532  (± 5.5%) i/s -    732.000  in   5.047857s

Comparison:
           redcarpet:    16851.2 i/s
commonmarker with to_html:    10699.4 i/s - 1.57x  (± 0.00) slower
commonmarker with to_xml:    10413.0 i/s - 1.62x  (± 0.00) slower
commonmarker with render_doc.to_html:     8896.2 i/s - 1.89x  (± 0.00) slower
commonmarker with ruby HtmlRenderer:     1133.9 i/s - 14.86x  (± 0.00) slower
            kramdown:      145.5 i/s - 115.79x  (± 0.00) slower

67f65d08057fd58be844a184043d586d3e8167a5 Rework rb_markdown_to_xml

input size = 9206 bytes

Warming up --------------------------------------
           redcarpet     1.714k i/100ms
commonmarker with to_html
                         1.018k i/100ms
commonmarker with to_xml
                         1.034k i/100ms
commonmarker with ruby HtmlRenderer
                       112.000  i/100ms
commonmarker with render_doc.to_html
                       750.000  i/100ms
            kramdown    14.000  i/100ms
Calculating -------------------------------------
           redcarpet     18.833k (± 2.9%) i/s -     94.270k in   5.010007s
commonmarker with to_html
                         11.402k (± 3.1%) i/s -     57.008k in   5.004576s
commonmarker with to_xml
                         11.328k (± 1.7%) i/s -     56.870k in   5.021896s
commonmarker with ruby HtmlRenderer
                          1.228k (± 2.7%) i/s -      6.160k in   5.020745s
commonmarker with render_doc.to_html
                          9.053k (±11.1%) i/s -     45.000k in   5.039098s
            kramdown    137.681  (±17.4%) i/s -    658.000  in   5.055183s

Comparison:
           redcarpet:    18832.8 i/s
commonmarker with to_html:    11402.2 i/s - 1.65x  (± 0.00) slower
commonmarker with to_xml:    11327.9 i/s - 1.66x  (± 0.00) slower
commonmarker with render_doc.to_html:     9052.8 i/s - 2.08x  (± 0.00) slower
commonmarker with ruby HtmlRenderer:     1227.8 i/s - 15.34x  (± 0.00) slower
            kramdown:      137.7 i/s - 136.79x  (± 0.00) slower

@ojab
Copy link
Contributor Author

ojab commented Feb 18, 2022

rubocop failures are unrelated, sending to review.

@ojab ojab marked this pull request as ready for review February 18, 2022 03:16
@ojab
Copy link
Contributor Author

ojab commented Feb 19, 2022

Fixed rubocop, hopefully you don't mind requiring mfa for rubygems.

@gjtorikian
Copy link
Owner

This all looks really great, thank you. As with any C change I want to take a deeper look at it (beyond the superficial one I've just given), but I don't see anything too outrageous. Thank you for your work. 😃

@kivikakk
Copy link
Collaborator

I've given it a once-over and local test; looking good at first blush! ❤️

@gjtorikian gjtorikian merged commit 722a3d1 into gjtorikian:main Feb 25, 2022
@ojab ojab deleted the lil_speedup branch June 1, 2022 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants