Zulip Chat Archive

Stream: lean4

Topic: Use of key in pickle?


Thomas Murrills (Jun 04 2024 at 22:14):

What does the key argument in a call to pickle (need to) do? What "cares" if it's distinct from another key, so to speak?

key is just the mod : Name argument of saveModuleData, but I'm not sure why this is important if we're not importing it as a module. (Or are we, under the hood, somehow?)

Mario Carneiro (Jun 04 2024 at 22:42):

If you load two pickles with the same key in the same session, they will hash to the same preferred location in memory, so one of them will have to be relocated, resulting in a significantly (~100x) slower load time because plain mmap doesn't work

Thomas Murrills (Jun 04 2024 at 22:43):

Oh, ok! Is the session considered ended when we free the compacted region?

Thomas Murrills (Jun 04 2024 at 22:46):

E.g. is let s ← withUnpickle "/my/Key/Is/Foo" f; let s' ← withUnpickle "/my/Key/Is/Also/Foo" g problematic or not?

Mario Carneiro (Jun 04 2024 at 22:46):

it should be ok

Mario Carneiro (Jun 04 2024 at 22:46):

but you should profile it to be sure

Mario Carneiro (Jun 04 2024 at 22:47):

it's really obvious when this happens

Thomas Murrills (Jun 04 2024 at 22:48):

Ok, thanks! (I'll record it here for posterity when I do profile it)


Last updated: May 02 2025 at 03:31 UTC