ethereum / py_ecc

Python implementation of ECC pairing and bn_128 and bls12_381 curve operations
MIT License
183 stars 82 forks source link

py_ecc is very slow to import #135

Open charles-cooper opened 4 months ago

charles-cooper commented 4 months ago

What happened?

py_ecc takes close to 1s to import. this increases startup time for anything which depends on py_ecc, including py-evm and titanoboa.

Code that produced the error

time python -c "import py_ecc"

Full error output

No response

Fill this section in if you know how this could or should be fixed

Not exactly sure, but one thing that jumped out is py_ecc could stop doing so much during module initialization. there are a lot of assertions throughout py_ecc modules which take a lot of CPU time and frankly should only be done during testing.

py-ecc Version

d5e5b2086483f9047cdaabf97eba7021bdf27168

Python Version

python 3.10-3.12

Operating System

No response

Output from pip freeze

No response

pacrob commented 5 days ago

Spent the morning poking at it, but nothing solid to go on. You are correct, all the non-test assert lines should be replaced anyway. Will come back to it next week.