Against my better judgement, and in the interest of speedy I/O, I've decided to use .mx files for a project - limitations and all. I'm dealing with a few gigabyte-sized datasets that I need in core for reasonably efficient computations and, despite other options, the ol .mx remains my best option (with some hand-rolled HDF5 coming in a close second).
I try to be reasonably clever and name the file with the name of the symbol or context I am exporting. Despite my cleverness I occasionally dump things into the Global' context and then misname the file.
I've perused the always insightful work of @MrWizard on the subject, especially here but I'm still adrift in a sea of Definition when it comes to this particular problem.
For a while, I figured that looking what was defined in Global' before and after, then comparing, would be of assistance, but, if the symbol is already defined (and subsequently gets clobbered) it means I'm out of luck there.
I feel like I'm missing something pretty obvious here - or not.
.mxdumps... it just doesn't seem to be at a 'nice' location in the file, like a header or something. It's always about ½ way through the file somewhere. – flip Feb 10 '17 at 16:02DefinitionvsFullDefinitionor some such that might be responsible for this? – flip Feb 10 '17 at 16:07DumpSave.DumpSave(andSave) will save definitions, and that can be pretty inconvenient, as you discovered. UseExportinstead. Thus, instead ofa=Range[100]; DumpSave["foo.mx", a], thenGet["foo.mx"]and thinking, "What was the name of that symbol?a?b? Somthing else?", just useExport["foo.mx", a]anda = Import["foo.mx"]. This won't save the symbol name and definition, it just exports the expression assigned to the symbol. Then you can re-assign to whatever symbol you like upon loading the file. – Szabolcs Feb 10 '17 at 16:08Global`and you dumped them also inGlobal`(for example) - because it relies in$NewSymbol. – Leonid Shifrin Feb 10 '17 at 16:09DumpSavebecause I was saving lots ofInterpolatingFunctions so I needed definitions. But you're certainly right in this case... data. Thanks to both you and @leonid – flip Feb 10 '17 at 16:11Import/Exportto store the data is that it is several times slower than using something likegetData = Function[file, Block[{data}, Get[file];data]]andputData = Function[{file, dt}, Block[{data = dt}, DumpSave[file, data]]], wheredatais some symbol (typically living in a package's private part, so thatBlockisn't too dangerous to use). – Leonid Shifrin Feb 10 '17 at 16:14