New to D
Era Scarecrow via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 27 15:16:36 PDT 2016
On Thursday, 27 October 2016 at 13:43:26 UTC, Steven
Schveighoffer wrote:
> It depends on the size of the file and the expectation of
> duplicate words. I'm assuming the number of words is limited,
> so you are going to allocate far less data by duping on demand.
> In addition, you may incur penalties for accessing the string
> directly from the file -- the OS may have swapped out that page
> and have to re-read it from the file itself.
>
> You could also read the entire file into a string and go based
> on that.
Depends. I recall experimenting early on with Memory mapped
files (80Mb-300Mb), and it instantly loaded, no time at all. I
don't think it even read the file or portions until I made
requests to it (Course in my instance I'd have to create virtual
records to access everything, still need to re-write and finish
that project).
It really depends on the circumstances though, and I suppose
also understanding when a buffer is shared/reused and when to use
dup.
More information about the Digitalmars-d-learn
mailing list