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

dev: refactor from_byte #432

Merged
merged 3 commits into from
Oct 18, 2023
Merged

dev: refactor from_byte #432

merged 3 commits into from
Oct 18, 2023

Conversation

chachaleo
Copy link
Contributor

Pull Request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

Resolves: #426

What is the new behavior?

optimize deserialization of Span to ByteArray

crates/utils/src/helpers.cairo Outdated Show resolved Hide resolved
crates/utils/src/helpers.cairo Outdated Show resolved Hide resolved
crates/utils/src/helpers.cairo Outdated Show resolved Hide resolved
@Eikix
Copy link
Member

Eikix commented Oct 18, 2023

Damn!!!!!!!
Nice first PR! Welcome;D

here's the performance outlook

image

@enitrat
Copy link
Collaborator

enitrat commented Oct 18, 2023

fyi: I think the word_not_full test has higher consumption, because the price of the divrem probably outweighs the cost of simply running the append_bytes fn three times.

It's interesting to see how this cost shifts when the number of bytes goes up. In real-world scenario, the bytecode will be a lot heavier, so it's going to save a lot!

Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

LGTM 💯
image

@enitrat enitrat added this pull request to the merge queue Oct 18, 2023
Merged via the queue into kkrt-labs:main with commit 9d8f6ec Oct 18, 2023
2 of 3 checks passed
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.

dev: optimize pack_bytes by skipping checks for initial n chunks with more than 31 bytes
3 participants