Speeding up text file parser (BLAST tabular format)

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 14 11:08:29 PDT 2015


On Monday, 14 September 2015 at 17:51:43 UTC, CraigDillabaugh 
wrote:
> On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund 
> wrote:
>> [...]
>
> I am going to go off the beaten path here.  If you really want 
> speed
> for a file like this one way of getting that is to read the file
> in as a single large binary array of ubytes (or in blocks if 
> its too big)
> and parse the lines yourself. Should be fairly easy with D's 
> array slicing.

my favourite for streaming a file:
enum chunkSize = 4096;
File(fileName).byChunk(chunkSize).map!"cast(char[])a".joiner()


More information about the Digitalmars-d-learn mailing list