Skip to content

Commit

Permalink
massive benchmark updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jul 15, 2024
1 parent 2b53685 commit 88ae1f2
Showing 1 changed file with 44 additions and 43 deletions.
87 changes: 44 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,33 @@ Comparing Selma against popular Ruby sanitization gems:
<!-- prettier-ignore-start -->
<details>
<pre>
input size = 25309 bytes, 0.03 MB

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
sanitize-sm 15.000 i/100ms
selma-sm 126.000 i/100ms
sanitize-sm 16.000 i/100ms
selma-sm 214.000 i/100ms
Calculating -------------------------------------
sanitize-sm 155.074 (± 1.9%) i/s - 4.665k in 30.092214s
selma-sm 1.290k1.3%) i/s - 38.808k in 30.085333s
sanitize-sm 171.670 (± 1.2%) i/s - 5.152k in 30.017081s
selma-sm 2.146k3.0%) i/s - 64.414k in 30.058470s

Comparison:
selma-sm: 1290.1 i/s
sanitize-sm: 155.1 i/s - 8.32x slower
selma-sm: 2145.8 i/s
sanitize-sm: 171.7 i/s - 12.50x slower

input size = 86686 bytes, 0.09 MB

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
sanitize-md 3.000 i/100ms
selma-md 33.000 i/100ms
sanitize-md 4.000 i/100ms
selma-md 56.000 i/100ms
Calculating -------------------------------------
sanitize-md 40.3215.0%) i/s - 1.206k in 30.004711s
selma-md 337.417 (± 1.5%) i/s - 10.131k in 30.032772s
sanitize-md 44.3972.3%) i/s - 1.332k in 30.022430s
selma-md 558.448 (± 1.4%) i/s - 16.800k in 30.089196s

Comparison:
selma-md: 337.4 i/s
sanitize-md: 40.3 i/s - 8.37x slower
selma-md: 558.4 i/s
sanitize-md: 44.4 i/s - 12.58x slower

input size = 7172510 bytes, 7.17 MB

Expand All @@ -236,12 +239,12 @@ Warming up --------------------------------------
sanitize-lg 1.000 i/100ms
selma-lg 1.000 i/100ms
Calculating -------------------------------------
sanitize-lg 0.144 (± 0.0%) i/s - 5.000 in 34.772526s
selma-lg 4.026 (± 0.0%) i/s - 121.000 in 30.067415s
sanitize-lg 0.163 (± 0.0%) i/s - 6.000 in 37.375628s
selma-lg 6.750 (± 0.0%) i/s - 203.000 in 30.080976s

Comparison:
selma-lg: 4.0 i/s
sanitize-lg: 0.1 i/s - 27.99x slower
selma-lg: 6.7 i/s
sanitize-lg: 0.2 i/s - 41.32x slower
</pre>
</details>
<!-- prettier-ignore-end -->
Expand All @@ -252,41 +255,39 @@ Comparing Selma against popular Ruby HTML parsing gems:

<!-- prettier-ignore-start -->
<details>
<pre>

input size = 25309 bytes, 0.03 MB
<pre>input size = 25309 bytes, 0.03 MB

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
nokogiri-sm 79.000 i/100ms
nokolexbor-sm 285.000 i/100ms
selma-sm 244.000 i/100ms
nokogiri-sm 107.000 i/100ms
nokolexbor-sm 340.000 i/100ms
selma-sm 380.000 i/100ms
Calculating -------------------------------------
nokogiri-sm 807.7903.1%) i/s - 24.253k in 30.056301s
nokolexbor-sm 2.880k 6.4%) i/s - 86.070k in 30.044766s
selma-sm 2.508k1.2%) i/s - 75.396k in 30.068792s
nokogiri-sm 1.073k2.1%) i/s - 32.207k in 30.025474s
nokolexbor-sm 3.300k13.2%) i/s - 27.540k in 36.788212s
selma-sm 3.779k3.4%) i/s - 113.240k in 30.013908s

Comparison:
nokolexbor-sm: 2880.3 i/s
selma-sm: 2507.8 i/s - 1.15x slower
nokogiri-sm: 807.8 i/s - 3.57x slower
selma-sm: 3779.4 i/s
nokolexbor-sm: 3300.1 i/s - same-ish: difference falls within error
nokogiri-sm: 1073.1 i/s - 3.52x slower

input size = 86686 bytes, 0.09 MB

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Warming up --------------------------------------
nokogiri-md 8.000 i/100ms
nokolexbor-md 43.000 i/100ms
selma-md 39.000 i/100ms
nokogiri-md 11.000 i/100ms
nokolexbor-md 48.000 i/100ms
selma-md 53.000 i/100ms
Calculating -------------------------------------
nokogiri-md 87.3673.4%) i/s - 2.624k in 30.061642s
nokolexbor-md 438.7823.9%) i/s - 13.158k in 30.031163s
selma-md 392.5913.1%) i/s - 11.778k in 30.031391s
nokogiri-md 103.9985.8%) i/s - 3.113k in 30.029932s
nokolexbor-md 428.9287.9%) i/s - 12.816k in 30.066662s
selma-md 492.1906.9%) i/s - 14.734k in 30.082943s

Comparison:
nokolexbor-md: 438.8 i/s
selma-md: 392.6 i/s - 1.12x slower
nokogiri-md: 87.4 i/s - 5.02x slower
selma-md: 492.2 i/s
nokolexbor-md: 428.9 i/s - same-ish: difference falls within error
nokogiri-md: 104.0 i/s - 4.73x slower

input size = 7172510 bytes, 7.17 MB

Expand All @@ -296,14 +297,14 @@ Warming up --------------------------------------
nokolexbor-lg 1.000 i/100ms
selma-lg 1.000 i/100ms
Calculating -------------------------------------
nokogiri-lg 0.895 (± 0.0%) i/s - 27.000 in 30.300832s
nokolexbor-lg 2.163 (± 0.0%) i/s - 65.000 in 30.085656s
selma-lg 5.867 (± 0.0%) i/s - 176.000 in 30.006240s
nokogiri-lg 0.874 (± 0.0%) i/s - 27.000 in 30.921090s
nokolexbor-lg 2.227 (± 0.0%) i/s - 67.000 in 30.137903s
selma-lg 8.354 (± 0.0%) i/s - 251.000 in 30.075227s

Comparison:
selma-lg: 5.9 i/s
nokolexbor-lg: 2.2 i/s - 2.71x slower
nokogiri-lg: 0.9 i/s - 6.55x slower
selma-lg: 8.4 i/s
nokolexbor-lg: 2.2 i/s - 3.75x slower
nokogiri-lg: 0.9 i/s - 9.56x slower
</pre>
</details>
<!-- prettier-ignore-end -->
Expand Down

0 comments on commit 88ae1f2

Please sign in to comment.