-
Notifications
You must be signed in to change notification settings - Fork 43
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
Performance degradation with Node 16 #29
Comments
Thanks for reporting, I can reproduce. A 31s vs 0.048s difference is huge! It looks like the main difference is that the global I can think of two potential solutions:
I can see a reasonable case for either one. For instance, if we go with # 1, then we're assuming that Node's built-in API has nothing useful to offer. Whereas maybe in the future, it will offer something like a visualization of marks/measures in the Chrome debugger's Profiler (one can hope, right?). Also if we go with # 1, now we permanently have a vast difference between the Node and browser version of marky. Effectively, we're treating Node as a polyfilled environment. Personally I am inclined to go with # 2 since it seems sad to me to polyfill something that Node already offers out-of-the-box. |
On second thought, maybe it makes sense to switch away from Node's built-in API now, while filing a bug on them in parallel. There's no compelling reason (currently) to use the built-in versus using our own, and the slowdown is pretty massive. |
Fixed in v1.2.3. I haven't filed the bug on Node yet; if you get around to doing that, please let me know. 🙂 |
Submitted an issue against node: nodejs/node#42004 |
Would it also be an option to keep using the performance api, but to use the returned |
Using the following minimal example:
leads to much slower performance is seen when using Node 16. Example run:
The reason for this degradation is that Node 16
performance.getEntriesByName()
runsflatMap
behind the scenes, an O(n) operation, where n is the number of marks in the buffer. In contrast, themarky
implementation for Node 14 uses a simple O(1) object property access. This will heavily affect users that do not clear their marks on short intervals or leak them, intentionally or not.The text was updated successfully, but these errors were encountered: