-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Optimized Implementation of Array#fill
for Zero Values
#8903
Conversation
Thank you for this! ❤️
Just a note: when making changes to the standard library (not the compiler) there's no need to compiler the compiler to try things out. Just using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
6769781 adds support for arrays for floating point numbers, as well (positive zero). this should cover arrays of all non-union numeric types, and should be suitable for most computational purposes. |
af3a1ec
to
6769781
Compare
Didn't even have time to merge it myself :) |
woo! my first legit contribution! |
See discussion here:
https://forum.crystal-lang.org/t/fastest-and-iconic-way-to-zero-an-array/1799/16
This PR provides a high performance (~10x) means to initialize arrays of integers to zero by optimizing that case in
Array#fill
.