0

I am using numpy.load in runtime as my application loads different numpy array based on external event.

My application is really low-latency oriented and I am struggling with numpy.load. I noticed that everytime i use numpy.load on particular array(saved as npy), the loading time is pretty slow(~0.2-0.3s), but every other time i do it again, the time is dramaticly reducing so after 2,3rd load it is even as low as 0.01s.

I am using classical syntax

data = np.load(name)

Later on, I pass data into some processing function and rewrite variale data

data = None

So my question is, what is happening? And if there is some kind of cache, can I load and rewrite all arrays in the beginning of the script so whenever I load array, its fast? If so, will the memory suffer?

Thanks in advance

Martin
  • 3,333
  • 2
  • 18
  • 39
  • Seems like you are looking for this: https://stackoverflow.com/questions/30329726/fastest-save-and-load-options-for-a-numpy-array – anishtain4 Dec 21 '18 at 19:37
  • OS caches disk reads. I don't know what is strategy, but for sure OS uses free memory for it. – Ante Dec 25 '18 at 16:53

0 Answers0