#27 Handle copying referenced objects#28
Conversation
d88d213 to
0465f73
Compare
|
This benchmark is not reliable at all... I get different results all the time - but constantly the old version is slightly faster |
Suddenly requiring this would be a breaking change, and I would like to avoid this as much as possible for what really is a bug fix. There is already an existing fallback implementation, and tweaking it for the same results would be trivial.
Welcome to JavaScript benchmarks. 😋 The goal is to see themes, not treat the results as biblical (it varies from machine to machine, and even on the same machine it varies from run to run due to system load and power management).
Slower here does not mean bad, because better accuracy is more important, especially since the reduction is small. A map will generally be a hair slower than a simple list, because the map has the relationship between two values whereas the list is just "does it exist or not", but that difference does not counteract the lack of accuracy. I'm on vacation right now, but once I'm back I can investigate more thoroughly. Looks solid at first glance, though, once the fallback is in place. |
0465f73 to
fbb0bb4
Compare
|
Thank you for the answer @planttheidea. I have added a simple WeakMap polyfill implementation. Should be enough as a simple fallback. About the benchmark: I totally agree - it is slightly slower but still keeps the first place and solves the issue correctly. |
Solves #27
Regarding using WeakMap - can we require to use a polyfill for that or we want to implement some simple implementation of it? It's widely supported across different browsers - https://caniuse.com/#search=weakmap
Benchmark - it's slightly slower with this fix. Maybe we can improve something? Or is simply WeakMap that much slower than the WeakSet?