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

perf: optimize molecule usage #640

Merged
merged 1 commit into from
Apr 12, 2022
Merged

perf: optimize molecule usage #640

merged 1 commit into from
Apr 12, 2022

Conversation

blckngm
Copy link
Contributor

@blckngm blckngm commented Apr 2, 2022

The principle here is to try to avoid Entity::from_slice or Reader::to_entity if possible, because they need to allocate and copy memory.

  • Replace Box<[u8]> -> as_ref -> Reader::from_slice_should_be_ok -> to_entity with from_box_should_be_ok!, which is from_slice_should_be_ok + into -> new_unchecked.

  • Replace Entity::from_slice -> as_reader with Reader::from_slice.

  • Replace to_entity -> unpack with unpack.

@Flouse Flouse requested review from jjyr and zeroqn April 6, 2022 04:10
jjyr
jjyr previously approved these changes Apr 6, 2022
@jjyr
Copy link
Collaborator

jjyr commented Apr 6, 2022

Pls rebase PR

Avoid uncessary allocation and copy.
@blckngm
Copy link
Contributor Author

blckngm commented Apr 6, 2022

Pls rebase PR

Done.

Did you leave a comment? I force-pushed to the branch too fast and couldn't see it any more.

@jjyr jjyr merged commit 634cc85 into godwokenrises:develop Apr 12, 2022
@blckngm blckngm deleted the optimize-molecule-usage branch April 13, 2022 12:06
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.

3 participants