Skip to content

refactor: use faster-eth-utils for better performance#266

Open
BobTheBuidler wants to merge 13 commits intoApeWorX:mainfrom
BobTheBuidler:patch-1
Open

refactor: use faster-eth-utils for better performance#266
BobTheBuidler wants to merge 13 commits intoApeWorX:mainfrom
BobTheBuidler:patch-1

Conversation

@BobTheBuidler
Copy link

@BobTheBuidler BobTheBuidler commented Sep 8, 2025

What I did

This PR implements faster-eth-utils, my faster fork of eth-utils.

Benchmarks are available here.

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

from ape.logging import logger
from ape.utils import ManagerAccessMixin
from eth_utils import to_checksum_address
from cchecksum import to_checksum_address
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't it make sense to re-export this via your package? (to maintain compatibility)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah that's a good idea but it isn't currently implemented and I have a bit of a pile in front of me to work thru first. Up to you how to handle it here for the time being. The faster implementation is still faster, just less magnitude of difference.

Copy link
Author

Choose a reason for hiding this comment

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

The most recent faster-eth-utils now uses the implementation from cchecksum

So it depends on how tight you'd like the pin to be

@fubuloubu
Copy link
Member

Overall, what platforms/architectures does this new package support?

@BobTheBuidler
Copy link
Author

It supports all CPython distros >= 3.8

@BobTheBuidler
Copy link
Author

Just # type: ignore'd the type error.

@fubuloubu
Copy link
Member

Just # type: ignore'd the type error.

oof, needs noqa: E501 at the end of it

@BobTheBuidler
Copy link
Author

done

fubuloubu
fubuloubu previously approved these changes Sep 15, 2025
@BobTheBuidler
Copy link
Author

BobTheBuidler commented Sep 16, 2025

bro what? evidently we can't have a type: ignore and a noqa: on the same line

should we just break up that line?

@fubuloubu
Copy link
Member

bro what? evidently we can't have a type: ignore and a noqa: on the same line

should we just break up that line?

sure, sounds fine

do you have any benchmarks for practical use in this repo btw? would be helpful!

(as a maintainer's note, this is a pretty safe repo to introduce this dependency to as it's very performance-sensitive, but has few down-stream dependencies that are other libraries)

@BobTheBuidler
Copy link
Author

wym "practical use"? I have benchmarks for all modules with a variety of input args. Is that what you're looking for?

@BobTheBuidler
Copy link
Author

but has few down-stream dependencies that are other libraries

What types of issues were you thinking of here?

@fubuloubu
Copy link
Member

wym "practical use"? I have benchmarks for all modules with a variety of input args. Is that what you're looking for?

I mean with silverback in action using the updated package

@fubuloubu
Copy link
Member

but has few down-stream dependencies that are other libraries

What types of issues were you thinking of here?

I'm hesistent to do it with ape / ape plugins / our more core infra packages yet until I understand any package conflicts or impacts, however Silverback is really mostly an end-user package (not meant to be used as a library, only as a framework for bot running) so the impact is rather limited. If it works well, then we can work on introducing it up the stack

@BobTheBuidler
Copy link
Author

wrt deps: the dependencies match the eth-utils dependencies for the version each release is based on if you use 4.x.x you should be able to drop in 4.x.x without any conflicts, and same for 5.x.x

@BobTheBuidler
Copy link
Author

wym "practical use"? I have benchmarks for all modules with a variety of input args. Is that what you're looking for?

I mean with silverback in action using the updated package

Oh no I don't have anything like that. But drop it in one to your most cpu-hungry bots and lmk!

@BobTheBuidler
Copy link
Author

BobTheBuidler commented Sep 27, 2025

I just ran black . locally and it tried to reformat not only this file but also main.py

So I pushed the changes it made to utils.py ONLY but can't say for sure that the changes were correct for your repo config, we'll see

@BobTheBuidler
Copy link
Author

finally, all green!

@fubuloubu fubuloubu changed the title feat: implement faster-eth-utils refactor: use faster-eth-utils for better performance Sep 29, 2025
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