• Kirill Smelkov's avatar
    bigarray: RAMArray · fc9b69d8
    Kirill Smelkov authored
    RAMArray is compatible to ZBigArray in API and semantic, but stores its
    data in RAM only. It is useful in situations where ZBigArray compatible
    data type is needed, but the amount of data is small and the data itself
    is needed only temporarily - e.g. in a simulation.
    Implementation is based on mmapping temporary files from /dev/shm/... and
    passing them as file handles, similarly to how ZBigArray works, to BigArray.
    We don't use just numpy.ndarray because of append - for ZBigArray append
    works in O(1), but more importantly it does not copy data. This way
    mmapings previously created for ZBigArray views, continue to correctly
    alias array data. If we would be using ndarray directly, since
    ndarray.resize copies data, that property would not be preserved.
    Original patch by Klaus Wölfel <klaus@nexedi.com>
array_ram.py 4.88 KB