-
Notifications
You must be signed in to change notification settings - Fork 71
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
Running time notes #172
base: master
Are you sure you want to change the base?
Running time notes #172
Conversation
|
Perhaps it would be best to expand and clarify the note at the top of the module instead; this is useful information and it's left implicit by that note right now. |
My mistake. I assumed Could an optimizer figure out that this is our intention, and avoid copying the array upon push? |
I highly doubt it; I can’t see that being safe unless it’s handled by the JS VM. |
Yeah, I'm not sure why it's implemented with slice rather than it being The only way we could safely avoid copying arrays is with linear types, so we know they're not reused, etc. |
Applied that change in the latest commit. Now what should the runtime notes be for the other functions? Should we either:
For the latter, which note format do you prefer? I see these three varieties in the docs:
|
I would prefer the third. I think we should explicitly say what |
I think most functions should have complexity noted, although not all. For instance, it doesn't really make sense to give |
Added some more running time notes. Wasn't sure about some of these though ( Also seems like |
It would be nice to be upfront about the runtime benefit of
snoc
, rather than having users confirm this for themselves by looking inArrays.js
.