ethereum / ethereum/eth-utils

Improve module load / import performance

Open
#293 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
335
Forks
167
PR merge metrics
No merged PRs in 30d

Description

### What feature should we add?

In some contexts, such as usage in modules that are meant to load super fast, importing from eth-utils becomes a little bottleneck.

In [1]: %time from eth_utils import to_checksum_address
CPU times: user 175 ms, sys: 9.1 ms, total: 184 ms
Wall time: 183 ms

Comparing it to Pydantic for no reason.

In [2]: %time from pydantic import BaseModel
CPU times: user 54.2 ms, sys: 7.14 ms, total: 61.3 ms
Wall time: 60.4 ms

I am just softly wondering if we can put forth some efforts to making this import faster.

Use-case:

1. Using in modules for CLI tools, which should load super fast so that using `--help` and such is fast.
2. Using in exceptions, logging, or other utils modules, which are somewhat expected to load fast.

Workaround

Can use localized imports, but that comes with other problems

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.