Skip to content

fix: restore surrogate default in pyhl binary main() - #24

Merged
danbugs merged 2 commits into
mainfrom
fix/surrogate-default-binary
May 14, 2026
Merged

fix: restore surrogate default in pyhl binary main()#24
danbugs merged 2 commits into
mainfrom
fix/surrogate-default-binary

Conversation

@danbugs

@danbugs danbugs commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

PR #22 moved default_surrogate_count() from the pyhl binary's main() into the library functions (install() and Runtime::new()). However, the binary's cmd_run() calls Sandbox::from_snapshot_file_configured() directly — bypassing both library entry points. This left HYPERLIGHT_INITIAL_SURROGATES unset for pyhl run, causing Hyperlight to pre-spawn all 512 surrogate processes (~3.5s on Windows).

  • Make default_surrogate_count() public in the library
  • Call it from main() in the binary so both setup and run paths are covered

Benchmark impact

Benchmark Before (PR #22) Expected after fix
hello_world (median) 1005 ms ~248 ms
pandas (median) 1678 ms ~757 ms

Signed-off-by: danbugs <danilochiarlone@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Benchmarks

Details
Benchmark suite Current: 1a15b27 Previous: 8affbcc Ratio
hello_world (median) 20 ms 20 ms 1
pandas (median) 100 ms 100 ms 1
density (per VM) 7 MB 7 MB 1
snapshot (disk) 384 MiB 384 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows Benchmarks

Details
Benchmark suite Current: 1a15b27 Previous: 8affbcc Ratio
hello_world (median) 259 ms 899 ms 0.29
pandas (median) 897 ms 1508 ms 0.59
density (per VM) 6 MB 6 MB 1
snapshot (disk) 392 MiB 392 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

Signed-off-by: danbugs <danilochiarlone@gmail.com>
@danbugs
danbugs enabled auto-merge May 14, 2026 14:39
@danbugs
danbugs merged commit f3c3ce4 into main May 14, 2026
74 checks passed
@danbugs
danbugs deleted the fix/surrogate-default-binary branch May 14, 2026 14:49
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.

1 participant