Why Strings as Classes?

BCS ao at pathlink.com
Mon Aug 25 17:52:44 PDT 2008


Reply to Benji,


> The new JSON parser in the Tango library operates on templated string
> arrays. If I want to read from a file or a socket, I have to first
> slurp the whole thing into a character array, even though the
> character-streaming would be more practical.
> 

Unless you are only going to parse the start of the file or are going to 
be throwing away most of it *while you parse it, not after* The best way 
to parse a file is to load it all in one OS system call and then run a slicing 
parser (like the Tango XML parser) on that. 

One memory allocation and one load or a mmap, and then only the meta structures 
get allocated later.





More information about the Digitalmars-d mailing list