Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization: Value handling operations #101

Closed
pepyakin opened this issue Jun 20, 2018 · 2 comments
Closed

Optimization: Value handling operations #101

pepyakin opened this issue Jun 20, 2018 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@pepyakin
Copy link
Collaborator

pepyakin commented Jun 20, 2018

Related to #99
Depends on #98

For now, functions like into_little_endian do an allocation. This is very unfortunate for the functions that are called upon every access to wasm memory.

At the very least, we can use change definition from

pub trait LittleEndianConvert where Self: Sized {
    fn into_little_endian(self) -> Vec<u8>;
    fn from_little_endian(buffer: &[u8]) -> Result<Self, Error>;
}

to something like this

pub trait LittleEndianConvert where Self: Sized {
    fn into_little_endian(&self, out: &mut [u8]); // Will panic if `out` of not appropriate size
    fn from_little_endian(buffer: &[u8]) -> Result<Self, Error>;
}

this will avoid allocations for into_little_endian case.

@pepyakin pepyakin changed the title Optimization: Optimize value handling Optimization: Optimize value handling operations Jun 20, 2018
@pepyakin pepyakin changed the title Optimization: Optimize value handling operations Optimization: Value handling operations Jun 20, 2018
@pepyakin pepyakin added the help wanted Extra attention is needed label Jun 21, 2018
@CryZe

This comment has been minimized.

@pepyakin

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants