-
-
Notifications
You must be signed in to change notification settings - Fork 670
Potentially eliminating Array.create<T> #853
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
Comments
Maybe we can do some benchmark to see how much performance loss this new approach would bring, but I think from the usability perspective this is certainly worth considering. |
Great idea. But I guess ut should be the same "null-ownership" analysis as in #456 |
Turns out that there were two length-checks in |
This is merged now, with updated documentation here: https://docs.assemblyscript.org/standard-library/array#api |
So I've been thinking about the
new Array<T>(10)
problematic a bit, and I figured that it might be worth to not throw on creating a holey array, but to instead throw when accessing a holey value. For instance, currentlybut this could be modified to
making
at the expense of an additional runtime check whether a value is
null
on element access, if the array's value type is non-nullable. Assuming that branch prediction will do fine there since actually reading anull
is unlikely and only happens in error cases. Thoughts?The text was updated successfully, but these errors were encountered: