-
Notifications
You must be signed in to change notification settings - Fork 64
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
Consider finding (or writing if need be) a float32 native math library #28
Comments
Couldnt we just download all the files from the original math package and do a fancy find and replace for float64->float32 then fix the 2-3 other mistakes it caused ? |
It's largely in assembly, so it's not quite that simple. On Fri, May 8, 2015 at 12:45 PM, Olivier Gagnon [email protected]
|
Granted, we could possibly do a find+replace on the assembly instructions On Fri, May 8, 2015 at 1:11 PM, Jeff Juozapaitis [email protected]
|
Yeah im working on it |
First results look promising |
No seriously are we getting anywhere on this. |
If you (or someone) submits a PR, I'd be happy to accept it. It should be a relatively straightforward patch to the generator code to sub your library for native match for the f32 version. I don't have time at the moment due to PhD stuff. |
After writing some benchmarks today (not for this package, just dicking around with benchmarking fast inverse square root compared to Go's stdlib and such), it's become clear that the rampant type conversions are a significant performance hit. "Significant" is in relative terms, but code of the form:
takes about
15.5 ns/op
compared to3.5 ns/op
for float64-native. I suspected this, hence why this library generally takes a "convert as infrequently as possible" approach. However, I would consider this significant enough to be worth worrying about.While Go's standard library is written partially in assembly, I don't think it should be too difficult to rewrite (I think most of the assembly conversions would amount to "swap a letter in the instruction names to do 32-bit operations instead"). However, I'd like to look into existing options if they exist before undertaking this.
I did find this, but the repository was deleted for some ominous reason.
The text was updated successfully, but these errors were encountered: