Speed of csvReader

Edwin van Leeuwen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 08:51:44 PST 2016


On Thursday, 21 January 2016 at 15:17:08 UTC, data pulverizer 
wrote:
> On Thursday, 21 January 2016 at 14:56:13 UTC, Saurabh Das wrote:
> @Edwin van Leeuwen The csvReader is what takes the most time, 
> the readText takes 0.229 s

The underlying problem most likely is that csvReader has (AFAIK) 
never been properly optimized/profiled (very old piece of the 
library). You could try to implement a rough csvReader using 
buffer.byLine() and for each line use split("|") to split at "|". 
That should be faster, because it doesn't do any checking.

Non tested code:
string[][] res = buffer.byLine().map!((a) => 
a.split("|").array).array;



More information about the Digitalmars-d-learn mailing list