refactor(compiler.rs): use hashmap for ABI storage - #335
Conversation
|
@clearloop @g4titanx what do you think about this change can I get a review on it |
|
i added a unit test to verify that the compiler correctly generate the ABI for the log example contract |
|
The CI is still broken XD, have you tried cargo test in the workspace? |
|
yes all test passed in the workspace locally |
i dont think you ran all tests, check ci build. |
but the error in the CI build suggest that some functions are not yet implemented in codegen/visitor/local.rs |
|
interesting, I'll take a look tonight |
|
@clearloop are you still looking into this, wanted to make a pr to complete the functions that are yet to be added |
sry for the late, I'm AFKing these days XD, but likely it is caused by local cache! (e.g. you can pass the tests locally because you are running on cache) |
But I cleared it by running cargo clean before running the test and it passed |
|
blocked by #337 |

this changes refactor the compiler to use Hashmap<String, Abi> instead of using Vec for storing contracts ABIs
the reason for this pr is because the current implementation uses a Vec, which requires an O(n) linear search to look up an ABI by name. this method can become inefficient and a significant performance bottleneck as the number of ABIs increase. By using a HashMap, we achieve average O(1) lookup time by keying on the contract name leading to improvement in perfomance.