The most efficient way to load formatted binaries in Python

I have binaries no larger than 20 MB that have a header section and then a data section containing uchars sequences. I have Numpy, SciPy, etc., And each library has different ways to load data. Any suggestions on the most effective methods I should use?

+5
source share
4 answers

A struct should work in the header section, and a numpy memmap would be effective for a data section if you would still manipulate it in numpy. There is no need to emphasize what is incompatible here. Both methods are compatible, just use the appropriate tool for each job.

+4
source

Use a struct module or perhaps a custom module written in C if performance is critical.

+8
source

bdec seems promising.

+1
source

I found that array.fromfileis the fastest method for uniform data.

0
source

All Articles