Regression?

FreeSlave via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 8 00:12:50 PDT 2015


On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe 
wrote:
> Fixed it by changing into:
>
> ```
> 	import std.conv : text;
> 	string json = 
> File("../languages.json","r").byLineCopy().joiner.text;
> 	auto ls = json.parseJSON();
> ```

Why would you read file by line and then merge all into one 
string? You end up with reading the whole file (well, getting rid 
of line ends) anyway, so probably the more efficient solution 
would be just read the whole file at once with std.file.read and 
cast to string.


More information about the Digitalmars-d-learn mailing list