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

Some operations make polkavm program size bloats #29

Open
indirection42 opened this issue Jun 18, 2024 · 0 comments
Open

Some operations make polkavm program size bloats #29

indirection42 opened this issue Jun 18, 2024 · 0 comments
Assignees

Comments

@indirection42
Copy link
Contributor

indirection42 commented Jun 18, 2024

I found this trivial operation bloats the polkavm program size (from 470B to 4KB)

let res_bytes = unsafe { core::slice::from_raw_parts(res_ptr, res_len as usize) };
sum += u64::from_le_bytes(res_bytes.try_into().unwrap());

compared to

sum += unsafe{ core::ptr::read_volatile(res_ptr as *const u64); }

I use polkatool to disassemble the program, and found the bloating part is Code size which goes from 287bytes to 3228 bytes.

@indirection42 indirection42 self-assigned this Jun 18, 2024
@indirection42 indirection42 changed the title Some type make polkavm program size bloats Some operations make polkavm program size bloats Jun 18, 2024
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

No branches or pull requests

1 participant