Bug 20950 – std.conv.text(int) shouldn't needlessly allocate

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-18T14:26:51Z
Last change time
2024-12-01T16:37:03Z
Assigned to
No Owner
Creator
Stanislav Blinov
See also
https://issues.dlang.org/show_bug.cgi?id=17712
Moved to GitHub: phobos#10424 →

Comments

Comment #0 by stanislav.blinov — 2020-06-18T14:26:51Z
Since it's using an appender, it seems strange that it goes via the std.conv.to.
Comment #1 by schveiguy — 2020-06-18T14:36:15Z
Yes, agree. And also, the code is all in there -- the code that writes the converted int to a static array buffer can be factored out of toImpl, and used to avoid an extra allocation.
Comment #2 by stanislav.blinov — 2020-06-18T15:42:22Z
Why just int?
Comment #3 by schveiguy — 2020-06-18T17:06:09Z
That is the current case. I agree it shouldn't needlessly allocate if it can help it. But then the "fix" needs to be defined as to how much allocation is needed. Int is straightforward -- the code is already in std.conv that can convert an int to text without allocation. The general case is not as straightforward.
Comment #4 by stanislav.blinov — 2020-06-19T12:43:06Z
Comment #5 by robert.schadek — 2024-12-01T16:37:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10424 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB