insta icon indicating copy to clipboard operation
insta copied to clipboard

Compressing the snap files

Open aminya opened this issue 3 years ago • 4 comments

Suggestion

My snap files are usually pretty large (thousands of lines of code), and adding them to the git repository pollutes the dev experience. I think it would be nice to maintain the compressed version of the snap files under the snapshot folder

P.S. I have written a script for one of my repos, and I can make it a feature of insta itself if you like.

Edit: I created a pull request that fixes the issue: https://github.com/mitsuhiko/insta/pull/279

aminya avatar Aug 30 '22 09:08 aminya

Would you commit compressed files to git? My hunch is that in terms of repository size actually adding compressed files rather than raw files is probably worse or at least not better considering that git compresses itself anyways.

How do you work with snapshots which are not committed to version control? Do you use something else to store them?

mitsuhiko avatar Aug 31 '22 07:08 mitsuhiko

Yeah, currently that's what I am doing, but the compressed files can be kept somewhere else as well.

In the PR I made, the original snap files are kept in the temporary files. See #279

aminya avatar Sep 01 '22 02:09 aminya

Hey, I’m late to the party, but you may be interested in what we’re doing in Meilisearch thanks to @loiclec. Basically, when the snapshots get too big, we only push a hash of the snapshot instead of pushing big files or compressing the files. But locally, we keep the uncompressed snap files, and you can see the « real » diff by settings the MILLI_TEST_FULL_SNAPS env variable.

irevoire avatar Sep 21 '22 11:09 irevoire

Kinda related to this issue. I was able to significantly reduce the size of my data by using postcard instead of json files.

Also, see: https://github.com/mitsuhiko/insta/issues/196#issuecomment-1290048650

aminya avatar Oct 25 '22 06:10 aminya