I'm looking for a convenient way to dump and load variables in Julia, just like pickle does in Python.
Is there a package which does something like myVar = load(myPath)
and dump(myVar, myPath)
(or similarly f = open(myPath, "r"); myVar = load(f)
) ?
An alternative is cPickle. It is nearly identical to pickle , but written in C, which makes it up to 1000 times faster. For small files, however, you won't notice the difference in speed. Both produce the same data streams, which means that Pickle and cPickle can use the same files.
quickle is a fast and small serialization format for a subset of Python types. It's based off of Pickle, but includes several optimizations and extensions to provide improved performance and security. For supported types, serializing a message with quickle can be ~2-10x faster than using pickle .
Is there a history about it? "Pickling" is process which enables storage and preservation. "Pickle" is "Pickle" because "Python" is "Python".
As mentioned above, the pickle module is Python-specific, and the result of a pickling process can be read only by another Python program.
HDF5.jl package have been split into HDF5 new package and JLD
see here: https://github.com/JuliaLang/JLD.jl
Saving and loading julia variables while preserving native types is now possible using JLD
According doc:
JLD, for which files conventionally have the extension .jld, is a widely-used format for data storage with the Julia programming language. JLD is a specific "dialect" of HDF5, a cross-platform, multi-language data storage format most frequently used for scientific data. By comparison with "plain" HDF5, JLD files automatically add attributes and naming conventions to preserve type information for each object.
I think the HDF5 package has the functionality you want, it worked very good for me using some custom types and all:
see here:
https://github.com/JuliaLang/HDF5.jl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With