my crude benchmark results
Bryce McKinlay
mckinlay@redhat.com
Wed Jul 14 18:53:00 GMT 2004
Tom Tromey wrote:
>Bryce> I think the main problem here, judging by the huge difference
>Bryce> shown by --fast-math, is that we implement the Math.* calls
>Bryce> inefficiently. In libjava we use the fdlibm library to
>Bryce> implement them, which is written in pure C and contains no
>Bryce> cpu-specific asm optimizations.
>>For non-strictfp code (like java.lang.Math), it seems to me that we
>could avoid fdlibm and just use the libc functions. Is that not so?
>I wonder if we could remove fdlibm entirely now that StrictMath is
>pure java.
>>Thats what I think. I've heard that Sun's VM implements Math.* calls by
calling the corresponding StrictMath.* versions, even though this is not
required by the spec, which presumably accounts for their poor showing
here. IBMs VM apparantly does something better.
We should also figure out if things like __builtin_sqrt(), ie the
inlines enabled by --fast-math in the front end, are good enough to
replace the Math.* functions. If so we could enable the inlines without
enabling the other "unsafe" back-end features that are implied by it.
The math headers on x86 linux just replace these math calls with their
__builtin equivilants, so it would certainly work there, but whether it
is safe to do this on all platforms I don't know.
Regards
Bryce
More information about the Java
mailing list