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

Reduce compute units consumption #1074

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

febo
Copy link
Contributor

@febo febo commented Apr 23, 2023

This PR optimizes the compute units usage on the unified create instruction.

Copy link
Contributor

@blockiosaurus blockiosaurus left a comment

Choose a reason for hiding this comment

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

This is awesome! Good work!

invoke_signed(
&system_instruction::assign(new_account_info.key, &program_id),
accounts,
&system_instruction::create_account(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

BorshSerialize::serialize(&self, &mut bytes)?;

let data = &mut account.data.borrow_mut();
data[..bytes.len()].copy_from_slice(&bytes);
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we talked about this before, but is this better or worse than sol_memcpy?

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.

None yet

2 participants