Ban use of Math.fma across the entire codebase (#12014)

When FMA is not supported by the hardware, these methods fall back to
BigDecimal usage which causes them to be 2500x slower.

While most hardware in the last 10 years may have the support, out of
box both VirtualBox and QEMU don't pass thru FMA support (for the latter
at least you can tweak it with e.g. -cpu host or similar to fix this).

This creates a terrible undocumented performance trap. Prevent it from
sneaking into our codebase.
This commit is contained in:
Robert Muir 2022-12-17 08:01:22 -05:00 committed by GitHub
parent 945d7fe027
commit 3ac71adbdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -66,3 +66,6 @@ javax.naming.spi.ContinuationDirContext
javax.sql.rowset.spi.ProviderImpl
javax.sql.rowset.spi.SyncFactory
@defaultMessage Math.fma is insanely slow (2500x) in many environments (e.g. VMs). Use multiply/add and suffer the extra rounding
java.lang.Math#fma(float,float,float)
java.lang.Math#fma(double,double,double)