Skip to content

Precompute fields in VMOffsets - #2821

Merged
fitzgen merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:faster-vmoffsets
Apr 8, 2021
Merged

Precompute fields in VMOffsets#2821
fitzgen merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:faster-vmoffsets

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit updates the implementation of VMOffsets to frontload all
checked arithmetic on construction of the VMOffsets which allows
eliding all checked arithmetic when accessing the fields of VMOffsets.
For testing and such this adds a new constructor as well from a new
VMOffsetsFields structure which is a clone of the old definition.

This should help speed up some profile hot spots I've been seeing where
with all the checked arithmetic on field sizes this was slowing down the
various accessors during instantiation (which uses VMOffsets to
initialize various fields of the VMContext).

This commit updates the implementation of `VMOffsets` to frontload all
checked arithmetic on construction of the `VMOffsets` which allows
eliding all checked arithmetic when accessing the fields of `VMOffsets`.
For testing and such this adds a new constructor as well from a new
`VMOffsetsFields` structure which is a clone of the old definition.

This should help speed up some profile hot spots I've been seeing where
with all the checked arithmetic on field sizes this was slowing down the
various accessors during instantiation (which uses `VMOffsets` to
initialize various fields of the `VMContext`).
@fitzgen
fitzgen merged commit 2a32567 into bytecodealliance:main Apr 8, 2021
@alexcrichton
alexcrichton deleted the faster-vmoffsets branch April 8, 2021 22:14
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.

3 participants