-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Sim: Faster type coercion in toID
#10619
base: master
Are you sure you want to change the base?
Sim: Faster type coercion in toID
#10619
Conversation
Ok, technically, this breaks for boolean and others. But there's no good reason to be passing those in the first place imo. Simple fix is to do '' + text more broadly, but I'll just put this on the backburner. Edit: aaand now I remember the original code doesn't handle bool anyway. Sigh. |
The reason why So, the fact that |
I understand that's the intent but based on #10549 (comment) The function's contract is just unnecessarily weak. |
That's true.
Yea. Changing that means that each of these functions would need a strict and a lax variant, thus doubling mental overhead from function names. And god forbid refactoring bugs, and having to think about |
To me, the more pressing source of that is how many states the system can be in. I think a simple system comes from predictable data flow. Lazy loading and Anyway, the fact that I can't meaningfully profile this ATM indicates I should be working on other problems. |
For the record, I do admit it was probably a mistake to use this function in hot code. I don't mind a separate |
51f29d3
to
f462716
Compare
Derivative of #10606
Stats
4*1024*1024 calls per row.
# uniq ...
is a running total.All others are per batch.
Stats during
npm run full-test
About 100 million total calls.
Pretty high proportion of
id === text
, which means IDs are being passed totoID
a lot.profiling code