Skip to content

Further compress the in-memory representation of address maps - #2324

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:compress-again
Nov 3, 2020
Merged

Further compress the in-memory representation of address maps#2324
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:compress-again

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit reduces the size of InstructionAddressMap from 24 bytes to
8 bytes by dropping the code_len field and reducing code_offset to
u32 instead of usize. The intention is to primarily make the
in-memory version take up less space, and the hunch is that the
code_len is largely not necessary since most entries in this map are
always adjacent to one another. The code_len field is now implied by
the code_offset field of the next entry in the map.

This isn't as big of an improvement to serialized module size as #2321
or #2322, primarily because of the switch to variable-length encoding.
Despite this though it shaves about 10MB off the encoded size of the
module from #2318

@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Oct 26, 2020
@github-actions

Copy link
Copy Markdown

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@alexcrichton

Copy link
Copy Markdown
Member Author

@peterhuene would you be able to take a look at this?

@peterhuene
peterhuene self-requested a review November 2, 2020 23:56
Comment thread crates/debug/src/transform/address_transform.rs

@peterhuene peterhuene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great 👍. I Just that one question related to a test as to not change the assert; not a blocker in any sense.

This commit reduces the size of `InstructionAddressMap` from 24 bytes to
8 bytes by dropping the `code_len` field and reducing `code_offset` to
`u32` instead of `usize`. The intention is to primarily make the
in-memory version take up less space, and the hunch is that the
`code_len` is largely not necessary since most entries in this map are
always adjacent to one another. The `code_len` field is now implied by
the `code_offset` field of the next entry in the map.

This isn't as big of an improvement to serialized module size as bytecodealliance#2321
or bytecodealliance#2322, primarily because of the switch to variable-length encoding.
Despite this though it shaves about 10MB off the encoded size of the
module from bytecodealliance#2318
@alexcrichton
alexcrichton merged commit 10b5cc5 into bytecodealliance:main Nov 3, 2020
@alexcrichton
alexcrichton deleted the compress-again branch November 3, 2020 02:37
cfallin pushed a commit that referenced this pull request Nov 30, 2020
This commit reduces the size of `InstructionAddressMap` from 24 bytes to
8 bytes by dropping the `code_len` field and reducing `code_offset` to
`u32` instead of `usize`. The intention is to primarily make the
in-memory version take up less space, and the hunch is that the
`code_len` is largely not necessary since most entries in this map are
always adjacent to one another. The `code_len` field is now implied by
the `code_offset` field of the next entry in the map.

This isn't as big of an improvement to serialized module size as #2321
or #2322, primarily because of the switch to variable-length encoding.
Despite this though it shaves about 10MB off the encoded size of the
module from #2318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants