Most performant way of converting int to string

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 22 14:19:20 PST 2015


On Tuesday, 22 December 2015 at 18:27:12 UTC, cym13 wrote:
> ...
> I don't think there is anything in the standard
> library that would really help here as (if I read it correctly) 
> it is mainly
> because of the conversion from ranges to arrays that this code 
> is slow.

Yes, it has been faster in past, when I last check and optimeze 
to!string. But because of @nogc it has been rewriten to Range 
base version which is slower. In this case it makes sense to add 
special version without @nogc (to!string will allocate memory 
anyway) which just use dup on buffer instead of make Range.

I will probably make pull request tomorrow.



More information about the Digitalmars-d-learn mailing list