-
Notifications
You must be signed in to change notification settings - Fork 59
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
Shorthand idea: false
instead of () => false
for equals
#218
Comments
might be premature optimization - i'd guess a modern JIT would inline a constant function returning false and eliminate what's left of it. |
that is an interesting point about JIT -- I made a little test to see what happens (perf.link) I only have these two browsers atm:
|
Modifying @NullVoxPopuli's test (perf.link) to include a loop results in the PS: Not sure if my version is benchmarking the right thing though, benchmarking is hard 😣 |
This is about more than the speed of calling the function: the signals system can have a more clear understanding of what's going on if it knows that it will always be false. |
And to add on to that, if it's faster to always call, an engine will set its internal Not that I even slightly find this likely, though. Not when it's only 3-4 instructions and |
in options for both
Signal.State
andSignal.Computed
, anequals
function is allowed to be passed to change how "dirtiness" is calculated -- it could be an optimization to allowfalse
instead of requiring a function to then call every time -- we could skip part of the dirtying algo.thoughts?
The text was updated successfully, but these errors were encountered: