In Mathematica, one can save intermediate results / the partial state of the workspace with Save (.m files) or DumpSave (.mx files).
.m files are portable, but are very slow to load (with large data).
.mx files are fast to load, but are not portable between platforms/architectures.
Is there a way to save generic Mathematica expressions in a way that loading them is fast, and they’re portable between platforms? Has anyone experimented with / benchmarked different methods to do this?
One possible solution is to save .m files (cross-platform), then convert them to .mx files when starting work on a new platform (a one-time operation). Is there a fully automatic way to convert .m files to .mx files?
From the posts Alexey linked:
This is not quite as fast as using an mx file, but it is still very fast.
David Bailey
Another alternative seems to be WDX (Wolfram Data eXchange) which I am
using without problems on a variety of machines and which also seems to
be portable, can be used exactly like MX files, is binary, is documented
and thus I would consider officially supported. And it is used by the
data paclet functionality, so I guess it is reasonably performant and
well tested on all systems (an assumption which my experience does
support up to now).
(excerpt from answer by Albert Retey, also from Alexey’s link)
But these do not work as
Save/DumpSavedoes, in that it does not save theFullDefinitionofexpr, only the explicit value ofexpr.