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

Slight code optimisations #2

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Conversation

mkalinin
Copy link
Contributor

There are a few places where slight optimisations are possible:

  • precompute the record_offset = i * RECORD_SIZE, saves a couple of mul ops
  • replace mul(3, head_idx) -> mul(3, i) -> add(prod1, prod2) with add(head_idx, i) -> mul(3, sum), saves a push, mul pair of ops
  • remove and(0xffffffff00000000000000000000000000000000, pk[32:48]) as the next shl(12*8, pk[32:48]) does the job

@lightclient
Copy link
Owner

sorry, was kicking off the CI

Copy link
Owner

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

Nice optimizations, LGTM!

@lightclient lightclient merged commit 57c5d94 into lightclient:main Mar 15, 2024
1 check 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.

2 participants