HDF5 for Python: high-level and low-level interfaces. h5py

I worked with HDF5 files with C and Matlab using the same method for reading and writing to datasets:

  • open file with h5f
  • open dataset with h5d
  • select a space with h5s

etc.

But now I work with Python , and with its h5py library h5py see that it has two ways to control HDF5: high-level and low-level interfaces. And with the first, it takes fewer lines of code to get information from a single file variable.

Is there any noticeable performance loss when using a high-level interface?
For example, when working with a file with many variables inside, and we should read only one of them.

+7
source share
1 answer

High-level interfaces usually come with loss of performance. After that, regardless of whether it is noticeable (worth exploring), it will depend on what you do with your code.

Just start with a high-level interface. If the code is too slow, start profiling and move the bottlenecks down to the lower level interface and see if it helps.

+2
source

All Articles