snogglethorpe / snogray

Snogray renderer

Home Page:http://www.nongnu.org/snogray

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable floating-point exceptions by default

snogglethorpe opened this issue · comments

Floating-point exceptions are disabled by default in linux, but Snogray has always explicitly enabled some of them (which takes some care, as the compiler and many libraries do not do the right thing by default, and merely enabling them in the FPU results in all manner of subtle bugs) in order to catch bugs.

This has helped catch many problems in the past, but it's literally been years since it last happened. Enabling exceptions comes with a cost, as it constrains the compiler (e.g. it cannot speculatively schedule divisions if it may result in a divide-by-zero exception).

So, it seems reasonable to disable them by default to gain some speed. They're easily enabled for debugging.

  • Do some benchmarks to see if disabling FP exceptions actually makes any real difference...

Some benchmarks seem to show that disabling floating-point exceptions doesn't actually make any real difference in runtime (and in fact, snogray seems slightly faster with exceptions enabled, despite the constraints on the compiler).

So we may as well leave them enabled.