I guess you could access it using mmap and simply loop through the array:

http://docs.julialang.org/en/latest/stdlib/io-network/?highlight=mmap#memory-mapped-i-o

I'd be curious, are there even faster alternatives?



Am 19.08.2015 um 12:10 schrieb Daniel Carrera <dcarr...@gmail.com>:

> Hello,
> 
> I need to count the number of lines in a large number of UNIX text files, 
> most of which are fairly large. I need help coming up with an efficient 
> implementation of a line-count program. A naive implementation like 
> length(readlines("foo.txt")) is very slow (notice how this loads the whole 
> file into memory just to count newlines). I imagine that it should be 
> possible to count the number of newline characters quickly, like what the 
> "wc" command does, but I can't figure out how. Does anyone have any ideas?
> 
> Thanks for the help.
> 
> Daniel.

Reply via email to