std.conv.to!string(float) Is too heavy
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Oct 12 22:58:51 UTC 2021
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
Being able to learn is a great learning; being able to unlearn is a greater learning.
More information about the Digitalmars-d