[phobos] Optimizing std.conv.parse for float conversions

David Simcha dsimcha at gmail.com
Tue Feb 16 18:39:29 PST 2010

I looked into creating D implementations of equivalent functions to 
strtold, etc. to address bug 3758 
(http://d.puremagic.com/issues/show_bug.cgi?id=3758).  It seems like 
converting strings to floats is actually pretty hard to do right, i.e. 
without any loss of precision.  However, the inefficiency of requiring 
several heap allocations per conversions hurts when reading in large 
files.  From some measurements I did, it seems like the heap allocation 
and associated garbage collection is the bigger source of overhead than 
the string copying.  Is everyone ok with me optimizing std.conv.parse to 
place the zero-terminated version of the string on the stack if it's 
reasonably small as a temporary fix?

More information about the phobos mailing list