-
Notifications
You must be signed in to change notification settings - Fork 1
Update #1
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
base: master
Are you sure you want to change the base?
Update #1
Conversation
1 similar comment
Shall we return |
What is the argument for returning an empty |
V8 deoptimizes the function if its return type changes when function is executed repeatedly. An empty array would still signal that there are no modes, and the user could always rely on the return value being an array and so e.g. map over it. Yet, I do think that having a consistent API for all functions would be preferable, so let's stick with |
Interesting. Do you have a reference for this V8 behavior? I am aware of monomorphic versus polymorphic function input optimization behavior. I was not aware of de-optimization for polymorphic return values; e.g., Although, upon consideration, even if not this function is not deoptimized, a consumer may be, as the JIT cannot make type inferences about the consumer's internal variables. This said, the consumer would only be deoptimized and possibly sent to deoptimization hell if some mixture of numeric and empty arrays were repeatedly provided to, e.g., this module. As long as a consumer only provides one or the other, the function and the consumer can be optimized. My thinking re: We could also write some documentation at some point regarding how to create fast computational code and discuss how to avoid having code deoptimized. In this case, ensure that no empty Your thoughts? |
I have to backtrack: I implemented a benchmark test and it seems as if there is no performance penalty arising from returning Agree with your reasoning re: different return types. |
The maximum should only be assigned if the count of the current value is greater than the maximum, not every time it is not the same.
[FIX] Maximum value assignment
According to todo + accessor fun support
Resolves compute-io/todo#4