Skip to content

Conversation

@lu-pinto
Copy link
Member

@lu-pinto lu-pinto commented Sep 26, 2025

This is already a ~10 ns operation but this PR is set to improve a little bit more in the worse cases (leading zeros and long byte matches) by inlining algorithm from Tuweni directly in besu and levering intrinsics.
Results below:
image

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

changelog entry?

@lu-pinto lu-pinto force-pushed the speed-up-eq branch 2 times, most recently from 78d0a1b to 821cc16 Compare September 30, 2025 14:13
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Copy link
Contributor

@ahamlat ahamlat left a comment

Choose a reason for hiding this comment

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

LGTM

{"0x000001", "0x", Condition.NOT_EQUAL},
{"0x000000", "0x", Condition.EQUAL},
{"0x321312", "0x321312", Condition.EQUAL},
{"0x321312", "0x0000321312", Condition.EQUAL},
Copy link
Contributor

@ahamlat ahamlat Oct 1, 2025

Choose a reason for hiding this comment

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

Could you add a test with something like
{"0x00321312", "0x03213120", Condition.NOT_EQUAL},

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
@lu-pinto lu-pinto enabled auto-merge (squash) October 1, 2025 16:38
@lu-pinto lu-pinto merged commit 482e852 into hyperledger:main Oct 1, 2025
63 of 65 checks passed
AliZDev-v0 pushed a commit to AliZDev-v0/besu that referenced this pull request Oct 5, 2025
improves EQ performance by ~2x in some of the worst cases

Signed-off-by: Ali Zhagparov <alijakparov.kz@gmail.com>
jflo pushed a commit to jflo/besu that referenced this pull request Oct 13, 2025
improves EQ performance by ~2x in some of the worst cases

Signed-off-by: jflo <justin+github@florentine.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants