perf(vm): Reduce suspended Vm memory footprint #434
Merged
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.
I ended up doing this absolutely on the side: I started thinking if keeping the entire Vm on the heap made sense. Avoiding copying the
result,exceptionandreferencevalues is an unquestionable win: These should not have any values that would be required after resuming since these are effectively "scratch space". Or at least I think that's the case :)Turning the
Vecs intoBox<[T]>is is much less clear. If theVechas zero capacity, then this is an unquestionable win as we just remove onecap: 0usizefrom the heap. If theVecis empty but has non-zero capacity then this is a maybe-win: This is adeallocof the vector's backing heap array. If theVecis non-empty (and is not full) then this is probably a loss, as it means we dealloc the old backing heap array and realloc a new, smaller array. This is kind of unlikely to really win us any prizes.The real question then becomes: How likely are these things?