dojo
dojo copied to clipboard
[BUG] sozo test high RAM usage (20GB+)
Describe the bug Running any simple tet on pistols consumes 18-20GB of RAM
To Reproduce
- clone pistols
cd dojosozo test -f test_initialize_table(any test will demonstrate there problem, this is a very simple one)- open Activity Monitor on macOS or a similar status monitor
- go to the Memory tab and filter by
sozo - while sozo builds, used memory goes up to 9GB, when it starts to run tests, it doubles and stays ~17-20GB
and please notice this gas consumption on simple tests (test_initialize_table_defaults)...
$ sozo test -f test_initialize_table
testing test(pistols_unittest) pistols v0.10.0-3 (/Users/roger/Dev/Realms/pistols/dojo/Scarb.toml)
running 2 tests
test pistols::tests::test_admin::tests::test_initialize_table ... ok (gas usage est.: 52,242,666)
test pistols::tests::test_admin::tests::test_initialize_table_defaults ... ok (gas usage est.: 54,464,862)
test result: ok. 2 passed; 0 failed; 0 ignored; 233 filtered out;
Expected behaviour A clear and concise description of what you expected to happen.
Screenshots
Additional context
- using Dojo 1.0.0-alpha.6 + Scarb 2.7
- The project uses the
origami_tokenpackage ERC-20 and ERC-721, and some openzeppelin utils. - Note that I have to include
openzeppelin_test_commonto be able to run tests, even if not using any openzeppelin in the tests
just to add some quick context, i checked the memory usage on spawn-and-move example that is in the repo and memory usage was around 1.2GB for build and 3.5GB for running the test (it only has couple of tests).
and since sozo build and sozo test are light wrapper around scarb i dont think the issue is specially related to sozo, i will do a memory profile to confirm this.
origami token package: ~4GB during build, ~8.5GB during tests
sozo test --package origami_token
@rsodre please can I be assigned
For the record, scarb has also notice significative increment of the compilation time. We may depend on what their bottleneck is.
@ShantelPeters do you have an idea of what could be dojo bottleneck related to compilation? Happy to assign if you have some suggestions.
Is there an scarb issue for that?
The language server is also consumes around 6GB.
Btw, running the same test with Dojo alpha 9, it's around 13GB
Sozo now doesn't use any custom compiler, and we are purely relying on scarb and Cairo-lang for that. Will close since no more optimization can be done on our end. 👍 (at least for now)