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.
In #448 it is pointed out that storing code in
Bytes
rather thanRc<Vec<u8>>
avoids an extra indirection in opcode fetch. This change is implemented in this PR.Public interfaces
Machine::new()
andRuntime::new()
are changed to have parametercode: Bytes
instead ofcode: Rc<Vec<u8>>
. Without this change, NEAR gas usage increases as constructingBytes
then would require cloning theVec
inside theRc
. (See numbers below.)While this doesn't break
aurora-engine
, it might break other things. For example,jsontests
would require an update to run on this fork.NEAR gas usage
Including this change in
aurora-engine
leads to test failures due to NEAR gas usage which is lower than expected:NEAR gas usage if public interface are not changed and instead `Vec` is cloned:
Question
Does this change make sense given that it requires breaking public interfaces for rather small improvements in NEAR gas usage?