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

chore(benchmark): add qs for query-param #3674

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

yusukebe
Copy link
Member

Results

Bun

cpu: Apple M1 Pro
runtime: bun 1.1.33 (arm64-darwin)

benchmark            time (avg)             (min … max)       p75       p99      p995
------------------------------------------------------- -----------------------------
• {"url":"http://example.com/?page=1","key":"page"}
------------------------------------------------------- -----------------------------
hono              55.74 ns/iter   (52.33 ns … 99.93 ns)  54.98 ns  81.25 ns  84.64 ns
fastQuerystring   92.22 ns/iter  (87.42 ns … 133.98 ns)  92.13 ns 121.04 ns 133.57 ns
qs               453.64 ns/iter (427.05 ns … 534.52 ns)  489.6 ns 528.12 ns 534.52 ns

summary for {"url":"http://example.com/?page=1","key":"page"}
  hono
   1.65x faster than fastQuerystring
   8.14x faster than qs

• {"url":"http://example.com/?url=http://example.com&page=1","key":"page"}
------------------------------------------------------- -----------------------------
hono             102.95 ns/iter  (94.49 ns … 160.88 ns) 102.36 ns 132.04 ns 134.34 ns
fastQuerystring  156.17 ns/iter (150.55 ns … 193.34 ns)  155.2 ns 182.93 ns  186.6 ns
qs               899.76 ns/iter   (856.82 ns … 1.03 µs) 930.88 ns   1.03 µs   1.03 µs

summary for {"url":"http://example.com/?url=http://example.com&page=1","key":"page"}
  hono
   1.52x faster than fastQuerystring
   8.74x faster than qs

• {"url":"http://example.com/?page=1"}
------------------------------------------------------- -----------------------------
hono              87.44 ns/iter  (84.97 ns … 137.35 ns)  86.69 ns  112.5 ns 118.92 ns
fastQuerystring   91.66 ns/iter  (87.04 ns … 131.07 ns)  91.67 ns 122.72 ns 126.75 ns
qs               462.12 ns/iter (434.73 ns … 558.96 ns)  500.7 ns 537.68 ns 558.96 ns

summary for {"url":"http://example.com/?page=1"}
  hono
   1.05x faster than fastQuerystring
   5.29x faster than qs

• {"url":"http://example.com/?url=http://example.com&page=1"}
------------------------------------------------------- -----------------------------
hono             164.72 ns/iter (159.32 ns … 208.86 ns) 162.85 ns 194.35 ns 201.04 ns
fastQuerystring  158.59 ns/iter (152.77 ns … 195.62 ns)  158.2 ns 184.01 ns 186.28 ns
qs               912.38 ns/iter      (866.65 ns … 1 µs) 945.33 ns      1 µs      1 µs

summary for {"url":"http://example.com/?url=http://example.com&page=1"}
  fastQuerystring
   1.04x faster than hono
   5.75x faster than qs

• {"url":"http://example.com/?url=http://example.com/very/very/deep/path/to/something&search=very-long-search-string"}
------------------------------------------------------- -----------------------------
hono             211.32 ns/iter  (204.2 ns … 254.13 ns) 210.56 ns 240.06 ns  243.7 ns
fastQuerystring  232.72 ns/iter  (225.18 ns … 264.7 ns) 232.35 ns 258.48 ns 264.67 ns
qs                 1.14 µs/iter       (1.1 µs … 1.2 µs)   1.17 µs    1.2 µs    1.2 µs

summary for {"url":"http://example.com/?url=http://example.com/very/very/deep/path/to/something&search=very-long-search-string"}
  hono
   1.1x faster than fastQuerystring
   5.4x faster than qs

• {"url":"http://example.com/?search=Hono+is+a+small,+simple,+and+ultrafast+web+framework+for+the+Edge.&page=1"}
------------------------------------------------------- -----------------------------
hono             565.53 ns/iter (531.95 ns … 733.21 ns) 562.48 ns 733.21 ns 733.21 ns
fastQuerystring  524.18 ns/iter   (498.38 ns … 1.22 µs) 518.98 ns 581.58 ns   1.22 µs
qs                 1.39 µs/iter      (1.3 µs … 2.29 µs)   1.39 µs   2.29 µs   2.29 µs

summary for {"url":"http://example.com/?search=Hono+is+a+small,+simple,+and+ultrafast+web+framework+for+the+Edge.&page=1"}
  fastQuerystring
   1.08x faster than hono
   2.64x faster than qs

• {"url":"http://example.com/?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8&i=9&j=10"}
------------------------------------------------------- -----------------------------
hono             322.88 ns/iter  (317.3 ns … 355.99 ns) 321.18 ns  351.3 ns 355.99 ns
fastQuerystring  225.32 ns/iter  (220.2 ns … 261.08 ns)  224.5 ns 254.85 ns 255.29 ns
qs                 2.83 µs/iter     (2.78 µs … 2.98 µs)   2.85 µs   2.98 µs   2.98 µs

summary for {"url":"http://example.com/?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8&i=9&j=10"}
  fastQuerystring
   1.43x faster than hono
   12.58x faster than qs

Node.js

cpu: Apple M1 Pro
runtime: node v20.18.0 (arm64-darwin)

benchmark            time (avg)             (min … max)       p75       p99      p995
------------------------------------------------------- -----------------------------
• {"url":"http://example.com/?page=1","key":"page"}
------------------------------------------------------- -----------------------------
hono              56.36 ns/iter     (52.7 ns … 75.7 ns)  57.07 ns  68.23 ns  70.14 ns
fastQuerystring   74.19 ns/iter     (71.7 ns … 89.5 ns)   76.1 ns  82.67 ns  83.32 ns
qs                 2.04 µs/iter     (2.01 µs … 2.17 µs)   2.04 µs   2.17 µs   2.17 µs

summary for {"url":"http://example.com/?page=1","key":"page"}
  hono
   1.32x faster than fastQuerystring
   36.18x faster than qs

• {"url":"http://example.com/?url=http://example.com&page=1","key":"page"}
------------------------------------------------------- -----------------------------
hono              82.06 ns/iter    (78.29 ns … 93.1 ns)  82.78 ns   87.3 ns  88.41 ns
fastQuerystring  215.25 ns/iter (210.46 ns … 236.26 ns) 215.84 ns  226.2 ns 226.24 ns
qs                 2.56 µs/iter     (2.52 µs … 2.72 µs)   2.56 µs   2.72 µs   2.72 µs

summary for {"url":"http://example.com/?url=http://example.com&page=1","key":"page"}
  hono
   2.62x faster than fastQuerystring
   31.16x faster than qs

• {"url":"http://example.com/?page=1"}
------------------------------------------------------- -----------------------------
hono              99.75 ns/iter  (97.22 ns … 115.05 ns) 101.81 ns 107.65 ns 110.71 ns
fastQuerystring   78.59 ns/iter   (76.58 ns … 94.75 ns)   79.2 ns  85.97 ns  87.07 ns
qs                 1.51 µs/iter     (1.49 µs … 1.54 µs)   1.51 µs   1.54 µs   1.54 µs

summary for {"url":"http://example.com/?page=1"}
  fastQuerystring
   1.27x faster than hono
   19.2x faster than qs

• {"url":"http://example.com/?url=http://example.com&page=1"}
------------------------------------------------------- -----------------------------
hono             182.29 ns/iter (178.06 ns … 233.63 ns)    184 ns 192.44 ns 202.41 ns
fastQuerystring  215.04 ns/iter  (210.82 ns … 236.1 ns) 216.53 ns 230.41 ns 236.04 ns
qs                 2.54 µs/iter     (2.53 µs … 2.57 µs)   2.55 µs   2.57 µs   2.57 µs

summary for {"url":"http://example.com/?url=http://example.com&page=1"}
  hono
   1.18x faster than fastQuerystring
   13.94x faster than qs

• {"url":"http://example.com/?url=http://example.com/very/very/deep/path/to/something&search=very-long-search-string"}
------------------------------------------------------- -----------------------------
hono             219.76 ns/iter  (215.22 ns … 240.9 ns) 221.23 ns 231.14 ns 231.66 ns
fastQuerystring  397.84 ns/iter (393.07 ns … 418.98 ns) 399.46 ns  415.2 ns 418.98 ns
qs                 2.81 µs/iter        (2.78 µs … 3 µs)   2.81 µs      3 µs      3 µs

summary for {"url":"http://example.com/?url=http://example.com/very/very/deep/path/to/something&search=very-long-search-string"}
  hono
   1.81x faster than fastQuerystring
   12.8x faster than qs

• {"url":"http://example.com/?search=Hono+is+a+small,+simple,+and+ultrafast+web+framework+for+the+Edge.&page=1"}
------------------------------------------------------- -----------------------------
hono               3.15 µs/iter     (3.11 µs … 3.29 µs)   3.16 µs   3.29 µs   3.29 µs
fastQuerystring    3.22 µs/iter      (3.2 µs … 3.27 µs)   3.22 µs   3.27 µs   3.27 µs
qs                 5.48 µs/iter      (5.4 µs … 5.62 µs)   5.53 µs   5.62 µs   5.62 µs

summary for {"url":"http://example.com/?search=Hono+is+a+small,+simple,+and+ultrafast+web+framework+for+the+Edge.&page=1"}
  hono
   1.02x faster than fastQuerystring
   1.74x faster than qs

• {"url":"http://example.com/?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8&i=9&j=10"}
------------------------------------------------------- -----------------------------
hono             445.64 ns/iter (432.59 ns … 500.45 ns) 448.16 ns  487.7 ns 500.45 ns
fastQuerystring  410.56 ns/iter (404.88 ns … 438.06 ns) 411.81 ns 426.95 ns 438.06 ns
qs                 8.42 µs/iter     (8.38 µs … 8.47 µs)   8.44 µs   8.47 µs   8.47 µs

summary for {"url":"http://example.com/?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8&i=9&j=10"}
  fastQuerystring
   1.09x faster than hono
   20.51x faster than qs

@yusukebe yusukebe merged commit 1e8ebe9 into main Nov 14, 2024
14 checks passed
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.70%. Comparing base (082862b) to head (076a171).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3674   +/-   ##
=======================================
  Coverage   91.70%   91.70%           
=======================================
  Files         159      159           
  Lines       10145    10145           
  Branches     2851     2860    +9     
=======================================
  Hits         9303     9303           
  Misses        840      840           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusukebe yusukebe deleted the chore/benchmark-add-qs-for-query-param branch November 14, 2024 20:05
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.

1 participant