Closed t-mat closed 4 months ago
Thanks for bringing this up. I had a self debate yesterday about this particular commit. Let me try and explain the thought process:
The direction of the project "rays" has definitely shifted now. In my mind "its about seeing how good can a program perform in a given language/compiler/design (l/c/d) combination whilst still keeping the code as close to real world as possible."
So, there are two kinds of optimizations in my mind:
I still believe in retaining the first one, but like I reversed the micro-opt with https://github.com/kid0m4n/rays/commit/bc029c5 yesterday, I want to bring all the implementations up to a stage where we do not avoid stuff like math.Pow(), etc. Instead, give scope for the compiler to do the right thing for you.
Then "rays" essentially becomes a good test bed to see how much we can extract from a l/c/d combination without doing benchmark specific optimization; by letting the compiler do its thing. As much as possible.
That being said, SSE in C++ is not something we need to avoid; in fact, its a USP in the language itself that it allows us to go from 12.7 s to 9.4 s by still writing C++. SSE is not the same as replacing math.Pow() in my mind
I want to know what you think about this though
I would like to see 2 versions of code for every language
"mainline" shows idiomatic way. Good for the language tourists. "hacked" shows back street of the language. Tourists should not walk into there, but locals enjoy the secret side of the language.
I think there are 4 ranks of goodness
I would like to see 1. and 2. in mainline of the code. But I also want to see 'insanely optimized' version by 3. 'Insane' version should not allowed to merge to mainline, but as you have seen these optimization clearly show some kind of the room and weakness.
More random thoughts:
+1 for @t-mat
There should be a clean vanilla version as basis for a "dirty" optimized version.
+1 for a clean reference version; and a crazy all out optimized version
(This issue is also related to @tkalbitz's PR #13)
In bc029c5, @kid0m4n has changed lazy computation for bounce. I think this project is not a serious optimization contest, so this change itself is okay.
But should we write more strict code ? I'm confusing about following things:
readme.md
p33
toMath.Pow(p, 99)
Example: Go's case