# Efficient serialization of JuMP results

**URL:** <https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, serialization\
**Created:** [September 28, 2022, 12:31am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896 "2022-09-28T00:31:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [September 28, 2022, 12:31am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/1 "2022-09-28T00:31:43Z")

</div>

What is a recommended workflow for efficiently serialising results data after solving a JuMP model? The information in the numbers are the important thing, not preserving the Julia object structure.  
For example, does anyone have experience using [JLD2](https://github.com/JuliaIO/JLD2.jl), say, compared to the standard library Serialization module?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 28, 2022, 1:10am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/2 "2022-09-28T01:10:15Z")

</div>

What’s the motivation? As a log to check against in future? To post-process in some other format? I’d say you’re best off creating a well-defined structure like a data frame and saving that, rather than some ad-hoc serialization of the JuMP model.

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [September 28, 2022, 1:38am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/3 "2022-09-28T01:38:13Z")

</div>

> [@odow](#):
>
> To post-process in some other format?

Yes, to save at the end of solve, and to post-process later into different formats and summaries. I currently transform to a dictionary of dataframes (variable symbol =\> dataframe of variable values) then serialise that dictionary using Serialization. This is currently a bottleneck in the workflow due to the time for saving, and would appreciate ideas for “quickly” saving the variable values.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 28, 2022, 6:21am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/4 "2022-09-28T06:21:55Z")

</div>

Did you profile why/where it’s a bottleneck? Is it constructing the dataframes? Seems unlikely that it’s writing them?

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [September 28, 2022, 7:22am UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/5 "2022-09-28T07:22:17Z")

</div>

Thanks, those questions will help me focus the issue; it’s probably my variable → dataframes code is not scaling well 🙂

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 28, 2022, 11:06pm UTC](https://discourse.julialang.org/t/efficient-serialization-of-jump-results/87896/6 "2022-09-28T23:06:00Z")

</div>

There’s an open issue for JuMP to implement the Tables.jl API to make this simpler: [Tables.jl support for results · Issue #3096 · jump-dev/JuMP.jl · GitHub](https://github.com/jump-dev/JuMP.jl/issues/3096)
