std.conv.to!string(float) Is too heavy

Hipreme msnmancini at hotmail.com
Thu Oct 14 00:04:52 UTC 2021


On Tuesday, 12 October 2021 at 22:58:51 UTC, H. S. Teoh wrote:
> On Tue, Oct 12, 2021 at 10:15:10PM +0000, Hipreme via 
> Digitalmars-d wrote:
> [...]
> [...]
>> I do hope that this gets noted by the decision people, having 
>> to reimplement stdlib is the last thing I wanted right now, 
>> but 500KB for string to float conversion per module, (without 
>> debug symbols ) is pretty unacceptable.
> [...]
>
> *Per module*?? That shouldn't be the case.  You must be doing 
> something wrong...  Are you using dmd or ldc?  You might want 
> to look into various options for eliminating duplicate template 
> instantiations, like -linkonce-templates, or LTO, or some such. 
>  No matter how bad the string-to-float bloat is (and I agree 
> it's bad), it should not be adding bloat *per module*.
>
> Possibly one thing to watch out for is using compile-time 
> format strings, i.e., `writeln!"abc %s def"(...)` instead of 
> runtime format strings `writeln("abc %s def", ...)`.  The 
> former has its uses, such as catching bad format strings at 
> compile-time; but it may potentially be the cause of a lot of 
> template bloat if you have a lot of different format strings.
>
>
> T


Humm I say module for representing libs, I have splitted my 
project in various libs, whose I call modules, so, it needs to 
link to each lib I'm using. Although I have implemented most I 
need right now, the current problem is std.array.

std.array increases 500Kb by only including it, so, for keeping 
my build times okay I have been basically ditching phobos...




More information about the Digitalmars-d mailing list