def-pri-pub

Joined 9 years ago

Karma
214
Submissions
19
Member since
Jan 3
C++/Qt Developer. Personal website: https://16bpp.net
View on Hacker News

Recent submissions

Comment · 7 months ago
>> It also gets in the way of elegance and truth.

Where did that come from in the article?

Comment · 7 months ago
Thank you for linking that!
Comment · 7 months ago
The reason for writing out all of the x multiplications like that is that I was hoping the compiler detect such a pattern perform an optimization for me. Mat Godbolt's "Advent of Compiler Optimizations" series mentions some of these cases where the compiler can do more auto-optimizations for the developer.
Comment · 7 months ago
I did see that, but isn't the vast majority of that page talking about acos() instead?
Comment · 7 months ago
I did scan some (major) open source games and graphics related project and found a few of them using `std::asin()`. I plan on submitting some patches.
Comment · 7 months ago
Thanks!
Comment · 7 months ago
When I was working on this project, I was trying to restrict myself to the architecture of the original Ray Tracing in One Weekend book series. I am aware that things are not as SIMD friendly and that becomes a major bottle neck. While I am confident that an architectural change could yield a massive performance boost, it's something I don't want to spend my time on.

I think it's also more fun sometimes to take existing systems and to try to optimize them given whatever constraints exist. I've had to do that a lot in my day job already.

Comment · 7 months ago
You'd be surprised how it actually is worth the effort, even just a 1% improvement. If you have the time, this is a great talk to listen to: https://www.youtube.com/watch?v=kPR8h4-qZdk

For a little toy ray tracer, it is pretty measly. But for a larger corporation (with a professional project) a 4% speed improvement can mean MASSIVE cost savings.

Some of these tiny improvements can also have a cascading effect. Imagining finding a +4%, a +2% somewhere else, +3% in neighboring code, and a bunch of +1%s here and there. Eventually you'll have built up something that is 15-20% faster. Down the road you'll come across those optimizations which can yield the big results too (e.g. the +25%).

Comment · 7 months ago
Funny enough that fdlimb implementation of asin() did come up in my research. I believe it might have been more performant in the past. But taking a quick scan of `e_asin.c`, I see it doing something similar to the Cg asin() implementation (but with more terms and more multiplications, which my guess is that it's slower). I think I see it also taking more branches (which could also lead to more of a slowdown).
Comment · 7 months ago
These are books that my uni courses never had me read. I'm a little shocked at times at how my degree program skimped on some of the more famous texts.
Comment · 7 months ago
Wait, what? Do you have a resource I could read up on about that? That is moderately concerning if your math isn't portable across chips.
Comment · 7 months ago
> floating point bithacks

The forbidden magic

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton