chakra-core / chakra-core/ChakraCore
Consider using Grisu3 + Dragon4 for double.ToString() conversion.
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I saw we are using library function [swprintf_s](https://github.com/Microsoft/ChakraCore/blob/701d1af560cf0060df493c65c596d86bed708d4b/lib/Runtime/Library/JavascriptNumber.cpp#L931) to convert a double value to string, which has performance issues that have been discussed in .NET Core. See https://github.com/dotnet/coreclr/issues/10390 and https://github.com/dotnet/coreclr/issues/10651
In .NET Core 2.0, there's a new implementation that combined Grisu3 + Dragon4 algorithms to significantly improved the performance (I should say probably 7x faster). See these two PRs: https://github.com/dotnet/coreclr/pull/14646
https://github.com/dotnet/coreclr/pull/12894
Replace swprintf_s with the new implementation could make the double conversion much more faster.
Contributor guide
Assessment
This issue has not been assessed yet.