Skip to content

Improve module load / import performance #293

@antazoey

Description

@antazoey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions