Recording data in a long running python simulation
问题 I am running a simulation from which I need to record some small numpy arrays every cycle. My current solution is to load, write then save as follows: existing_data = np.load("existing_record.npy") updated = np.dstack((existing_data,new_array[...,None])) np.save("existing_record.npy",updated) This has created a big performance bottleneck and the simulation runs at half the speed with this method. I have considered appending the numpy arrays to a list and writing it at the end of the