The behavior of compilation time increasing significantly when assert_eqs got added in tests utilizing generic functions over many test types was first noticed when we wrote tests for references in #5406.
We didn't investigate it at that time. The same effect is now noticeable in the in_language_tests for StorageVec where the compilation time of test projects gets longer as the number of tested types and assert_eq calls increased.
During that noticeable long compilation, one CPU is always on 100%.
In addition to long compilation, in the case of StorageVec tests, we also reach the data section limit:
thread 'main' (3610669) panicked at sway-core/src/asm_lang/allocated_ops.rs:999:19:
Unable to offset into the data section more than 2^12 bits. Unsupported data section length: 4807 words.
Inspection of the data section shows lot of log ids, which makes sense because assert_eq logs both arguments. In the case of these tests utilizing generic functions, those we have >30 different types for those arguments.
Aside form log ids, there are many entries in the data section that are just words.
The current workaround is to:
- split the test projects into several smaller ones,
- replace
assert_eq with assert.
The behavior of compilation time increasing significantly when
assert_eqs got added in tests utilizing generic functions over many test types was first noticed when we wrote tests for references in #5406.We didn't investigate it at that time. The same effect is now noticeable in the
in_language_testsforStorageVecwhere the compilation time of test projects gets longer as the number of tested types andassert_eqcalls increased.During that noticeable long compilation, one CPU is always on 100%.
In addition to long compilation, in the case of
StorageVectests, we also reach the data section limit:Inspection of the data section shows lot of log ids, which makes sense because
assert_eqlogs both arguments. In the case of these tests utilizing generic functions, those we have >30 different types for those arguments.Aside form log ids, there are many entries in the data section that are just words.
The current workaround is to:
assert_eqwithassert.