Skip to content

Consider using Grisu3 + Dragon4 for double.ToString() conversion. #5609

@mazong1123

Description

@mazong1123

I saw we are using library function swprintf_s 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: dotnet/coreclr#14646
dotnet/coreclr#12894

Replace swprintf_s with the new implementation could make the double conversion much more faster.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions