Coder Social home page Coder Social logo

Comments (9)

larsoner avatar larsoner commented on June 28, 2024

This would be pretty awesome. It would potentially save a lot of hard drive space.

from mne-python.

dengemann avatar dengemann commented on June 28, 2024

also +1 for this

On 07.10.2012, at 18:37, Eric89GXL [email protected] wrote:

This would be pretty awesome. It would potentially save a lot of hard drive space.


Reply to this email directly or view it on GitHub.

from mne-python.

mluessi avatar mluessi commented on June 28, 2024

I had the same idea a while ago. My hope was that using compression would also make reading and writing faster when using NFS volumes. I did an experiment , see

mluessi@386df6c

In my experiments it was very slow, maybe there is a way to make it faster :).

from mne-python.

agramfort avatar agramfort commented on June 28, 2024

looks like a cool sunday hack as I like to call this :)

how much slower ? do you know?

from mne-python.

larsoner avatar larsoner commented on June 28, 2024

Looks like bzip2 is an order of magnitude slower than gzip, so gzip might be the way to go even though it results in slightly larger file sizes, e.g.,:

http://tukaani.org/lzma/benchmarks.html

Although it might also make sense just to implement both while we're at it, and suggest that users use gzip for speed. Thoughts?

from mne-python.

larsoner avatar larsoner commented on June 28, 2024

Since that site used a stronger compression option for bzip (which is unfair), consider this site which didn't:

http://blog.terzza.com/linux-compression-comparison-gzip-vs-bzip2-vs-lzma-vs-zip-vs-compress/

Looks like compression is pretty similar, but decompression (where I'd imagine using it most for raw files and the like) is faster for gzip and zip...

from mne-python.

agramfort avatar agramfort commented on June 28, 2024

you should read this:

http://gael-varoquaux.info/blog/?p=159

from mne-python.

larsoner avatar larsoner commented on June 28, 2024

That is interesting. After reading it, I lean toward using gzip. It looks like zlib1 or zlib3 tended to do the best, and from what I understand those are abstractions of the same compression scheme used in the gzip format. The conclusions drawn from that site were:

...
4. Depending on the size of the data, it may be more efficient to store subsets in different files: it introduces ‘chunk’ that avoid filling in the memory too much (parameter cache_size in joblib’s code). In addition, data of a same nature tends to compress better.
5. The I/O stream or file object interfaces are abstractions that can hide the data movement and the creation of large temporaries. After experiments with GZipFile and StringIO/BytesIO I found it more efficient to fall back to passing around big buffer object, numpy arrays, or strings.
6. For reasons 4 and 5, I ended up avoiding the gzip module: raw access to the zlib with buffers gives more control. This explains a good part of the differences in read speed for pure arrays with numpy’s
...

However, for us, I imagine 4 won't be a big issue. When data are loaded with preload=True (which I imagine would satisfy most use cases), issue 5 shouldn't matter. We might have to see what happens without it...

In any case, the thing I like about gzip compared to some of the other options (using numpy's routines or compressing matrices individually and saving those) is that it maintains compatibility in the sense that, if I want, I can use a GUI to decompress the file and look at it. If we stored it in some other format, then a user wouldn't be able to do that. I would have no problem saving my data long-term in .gz format, but I'm not sure I'd be comfortable doing it with a format I'd have to go into python (or more likely, mne-python) to extract.

from mne-python.

agramfort avatar agramfort commented on June 28, 2024

I would investigate 2 approaches

1/ indeed .gz files that you can expand on any system
2/ or just gzip the data buffers and create a fif tag for compressed float
buffer matrices.

the issue with 2 is that mne and neuromag tools won't be able to read it.

I guess let's see if 1/ works (compress good and is fast enough on real
data)

from mne-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.