Repository navigation
Skip redundant host function registration on reload - #422
Merged
ludfjig merged 2 commits intoNov 12, 2026
Merged
Conversation
get_loaded_sandbox and unload each called RegisterHostModules, although the base snapshot already holds that registration. A load/unload cycle made four guest calls. Only register_handler and RunHandler are needed. Register host functions only when a restored snapshot records different ones than the builder supplies. On add_load_handle_unload this cuts 415 to 315 us on MSHV and 248 to 203 us on KVM. Bump the snapshot metadata schema to 2, since 0.5.0 snapshots can record host functions their base never registered. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
ludfjig
force-pushed
the
skip-host-module-reregistration
branch
from
November 11, 2026 22:26
95441bf to
befbc01
Compare
simongdavies
previously approved these changes
Nov 12, 2026
simongdavies
left a comment
Member
There was a problem hiding this comment.
A couple of questions but otherwise LGTM, I think we need to do release notes the same as for hyperlight as this has breaking changes and the move to hyperlight v0.19 will also cause breaking changes, I will look at this later.
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
simongdavies
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_loaded_sandboxandunloadeach calledRegisterHostModules, although the base snapshot already holds that registration. A load/unload cycle made four guest calls, but onlyregister_handlerandRunHandlerare needed. In hyperlight-dev/hyperlight-bench#46,kvm-hyperlight-js-reloadlost 15% throughput against 0.4.0.This change registers host functions only when a restored snapshot records different ones than the builder supplies. It then takes a new base snapshot, so later cycles skip registration.
full_lifecycle/add_load_handle_unload:KVM stays about 10% slower than 0.4.0 because each guest call costs more in Hyperlight 0.18.
Breaking: the snapshot metadata schema is now 2. Snapshots from 0.5.0 can record host functions their base never registered, so they are rejected and must be recreated.