Skip to content

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

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

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
Copy link
Copy Markdown
Contributor

@MaykThewessen MaykThewessen commented Jun 5, 2026

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
Copy link
Copy Markdown
Collaborator

FBumann commented Jun 5, 2026

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.

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.

2 participants