microsoft / microsoft/STL

`<charconv>`: `from_chars()` for `float` uses unnecessarily large structures

Open
#2,162 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

I noticed that the from_chars implementations for both float and double use the _Floating_point_string structure, which is huge (almost 800byte). The structure appears to be allocated on the stack only.
I don't know how many bytes are needed for the float conversion, but certainly a lot less than the 800 bytes for the double conversion.

Maybe it is worth to use a (much) smaller structure for from_chars for float values?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the from_chars implementations for float and double in and inspect _Floating_point_string to measure which storage is needed for each conversion. Done means the float path uses a smaller structure while preserving conversion behavior; run the relevant charconv tests to verify it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.