Please review JDK-8010803: Number to String conversion functionality overhaul:

http://cr.openjdk.java.net/~hannesw/8010803/

This is a mostly complete port of the V8 double conversion code[1] to Java. It includes Bignum-based algorithms for converting doubles to shortest, precision, and fixed decimals representation, as well as specialized faster algorithms for each of the conversion modes.

The only thing I left out is string to number conversion and support for single precision floats, both of which is not needed for Nashorn. I also ported all the relevant tests, which includes 100,000 random numbers for each of the (shortest|precision|fixed) conversion modes as well as well as unit tests for various implementation classes.

With this new dtoa conversion we are fully compatible with all other JS implementations. The fast algorithms are also about 5x faster than what we had before. The fallback Bignum implementation still roughly provides a 2x speedup.

[1]: https://github.com/google/double-conversion

Thanks,
Hannes

Reply via email to