You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At minimum, I would say nibabel.testing does not need to be loaded when I run import nibabel, but I also think PIL, h5py, pydicom and XML probably don't need to be loaded unless you use a file format that requires them.
Particularly given nibabel's position as a basic requirement for practically the entire Python neuroimaging ecosystem, we should try to be a lightweight import.
The text was updated successfully, but these errors were encountered:
I frequently get about a 1s import for nibabel. Which isn't too bad in itself, but as I'm trying to pare down import times for libraries with more dependencies, nibabel is one of several that add noticeably to the load time, and typically the hardest to isolate.
I wrote a profiler to time successive imports and count the number of modules and virtual memory allocations after each successive import. Here it shows about a 450ms load time (after loading sys, importlib, psutil and time), but fully half of that is nose:
I think it shouldn't be too much trouble. I'll have a look maybe tomorrow. And I think it's probably fine to ignore PIL and xml, looking at those numbers.
Beyond numpy, nibabel loads the following modules on import:
At minimum, I would say
nibabel.testing
does not need to be loaded when I runimport nibabel
, but I also thinkPIL
,h5py
,pydicom
andXML
probably don't need to be loaded unless you use a file format that requires them.Particularly given
nibabel's
position as a basic requirement for practically the entire Python neuroimaging ecosystem, we should try to be a lightweight import.The text was updated successfully, but these errors were encountered: