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

improve webidl.is.x performance for common case #3708

Closed

Conversation

KhafraDev
Copy link
Member

The trade off is although the more common case is 40x faster, the bad case is much slower.

ie. FormData.prototype.append.call({}, ...) will be ~7x slower than before.

cpu: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
runtime: node v22.9.0 (x64-win32)

benchmark                                time (avg)             (min … max)       p75       p99      p999
--------------------------------------------------------------------------- -----------------------------
common (good) case - isPrototypeOf     3.42 ns/iter    (3.22 ns … 54.74 ns)   3.37 ns   5.47 ns  10.01 ns
uncommon (bad) case - isPrototypeOf    4.46 ns/iter     (4.3 ns … 46.34 ns)   4.35 ns   6.69 ns  11.77 ns
common (good) case - #symbol in fd       87 ps/iter        (49 ps … 211 ns)     98 ps     98 ps    391 ps !
uncommon (bad) case - #symbol in fd   28.11 ns/iter   (27.59 ns … 69.63 ns)  27.93 ns  33.25 ns  48.19 ns

summary
  common (good) case - #symbol in fd
   39.14x faster than common (good) case - isPrototypeOf
   51.01x faster than uncommon (bad) case - isPrototypeOf
   321.47x faster than uncommon (bad) case - #symbol in fd

@KhafraDev KhafraDev marked this pull request as draft October 9, 2024 16:58
@KhafraDev KhafraDev closed this Oct 9, 2024
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