sam81 / BDF.jl

Module to read Biosemi BDF files with the Julia programming language
MIT License
8 stars 7 forks source link

Reduce allocated memory #14

Open rob-luke opened 8 years ago

rob-luke commented 8 years ago

Reading a 262 mb file allocates 916.65 mb of memory. Allocating over 3 times more memory than the file size seems a lot. But looking at your code I see no obvious inefficiencies. Do you think the allocated memory could be reduced?

sam81 commented 8 years ago

Partly the reason may be that the BDF files are stored with a 24-bits depth, while when the data are imported in Julia they are represented as 32-bit floats. However, I guess that can't explain a 3x difference. Maybe using a (memory-mapped file)[https://en.wikipedia.org/wiki/Memory-mapped_file] could be a solution to this issue. I've never tried this, so I'm not sure how it works, but it may be interesting to investigate this approach.