Regression?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 8 11:37:47 PDT 2015


On Tuesday, September 08, 2015 07:12:50 FreeSlave via Digitalmars-d-learn wrote:
> 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.

Or just use std.file.readText:

http://dlang.org/phobos/std_file.html#readText

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list