Skip to content

Add same-machine linopy vs polar-high build+IO benchmark#765

Closed
MaykThewessen wants to merge 1 commit into
PyPSA:masterfrom
MaykThewessen:io-api-polar-high-same-machine
Closed

Add same-machine linopy vs polar-high build+IO benchmark#765
MaykThewessen wants to merge 1 commit into
PyPSA:masterfrom
MaykThewessen:io-api-polar-high-same-machine

Conversation

@MaykThewessen

@MaykThewessen MaykThewessen commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #740. The cross-tool numbers there were measured on different hardware, so only ratios were comparable. This adds a self-contained benchmark/io_api_compare/ harness that runs all four columns through one process-per-cell harness, one HiGHS build, one machine:

  • linopy-lp (build -> .lp file -> HiGHS reparse)
  • linopy-direct (build -> in-memory highspy load)
  • polar (polar-high regular)
  • polar-sm (polar-high save_memory=True)

Same dense basic_model LP, HiGHS time-limited to isolate the modelling + IO path, peak RSS via /usr/bin/time -l.

Results (macOS arm64, single thread, HiGHS 1.14.0, linopy 0.7.0, polar-high 2.4.5)

At N=3000 (~18M variables):

Tool build+IO time peak RSS
linopy-direct 33.7 s 15.6 GB
polar-high (regular) 53.9 s 12.8 GB
polar-high (save_memory) 82.7 s 11.0 GB
linopy-lp 94.4 s 16.0 GB
tool_compare

Ranking stable across N=500..3000.

Takeaways

Plot (tool_compare.svg/.png) and raw CSV are included. Happy to adjust scope, wire it into the Snakemake flow, or drop the committed artifacts if you'd rather keep benchmark/ script-only.

🤖 Generated with Claude Code

Self-contained harness comparing linopy (io_api lp/direct) against
polar-high (regular and save_memory) on the identical dense LP, one
machine, one HiGHS build. Addresses the cross-hardware ambiguity in PyPSA#740:
the original numbers were measured on different machines so only ratios
were comparable.

Result: io_api="direct" is fastest on build+IO (reverses the lp-path
ranking); polar-high retains a lower peak RSS. The modelling-layer gap
is a memory gap, not a speed gap.
@FBumann

FBumann commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

I think polars-high is not mature enough to add it to our benchmark. But tis PR is highly apreciated as an artifact and measurement.

@coroa

coroa commented Jun 9, 2026

Copy link
Copy Markdown
Member

Note also that polars-high is more or less a highs only framework. For all other solvers it builds the problem and communicates to highs then dumps it into a MPS and then loads this MPS in the other solver.

@FabianHofmann

Copy link
Copy Markdown
Collaborator

thanks @MaykThewessen , given the context and the separate benchmark refactor by @FBumann, I would close this pr, but let's reuse it later if if the topic rises again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants