xdf-modules / pyxdf

Python package for working with XDF files
BSD 2-Clause "Simplified" License
37 stars 17 forks source link

Preallocate the read buffer for numerical data #46

Closed tstenner closed 5 years ago

tstenner commented 5 years ago

For numerical chunks, each sample has a constant size, so this change allocates and reuses a read buffer to avoid one allocation per sample. With a large sample file (64 double channels, 1M samples) the total runtime decreases by 11% and the context switches by 98%.

cbrnr commented 5 years ago

Nice change!

cbrnr commented 5 years ago

Can you add a CHANGELOG entry?

tstenner commented 5 years ago

Done.

cbrnr commented 5 years ago

Thanks @tstenner!