vyperlang / titanoboa

a vyper interpreter
https://titanoboa.readthedocs.io
Other
251 stars 49 forks source link

Cache db #206

Closed sajal closed 5 months ago

sajal commented 5 months ago

What I did

How I did it

By only doing db initialization if _db attribute was not defined earlier

How to verify it

Ensure you have plyvel installed

rm -fvr ~/.cache/titanoboa/fork.db
pytest -s tests/integration/fork/test_abi_contract.py
pytest -s tests/integration/fork/test_abi_contract.py

The second run should take significantly less time. For me ~78s vs ~2s

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

charles-cooper commented 5 months ago

i'm investigating this bug and i'm reconsidering whether using leveldb is a good idea, since it does not behave nicely when accessed concurrently from multiple processes

charles-cooper commented 5 months ago

i'm investigating this bug and i'm reconsidering whether using leveldb is a good idea, since it does not behave nicely when accessed concurrently from multiple processes

ref: https://github.com/google/leveldb/blob/068d5ee1a3ac40dabd00d211d5013af44be55bea/doc/index.md#concurrency

charles-cooper commented 5 months ago

the LOCK exception should be fixed in 665676e72784e5616f612b92043c6a856e8ec53b and the behavior you observed with _db getting wiped after init should be fixed in f84bad9cd437132dec9a1f2c3dc7f007bfb5fb43