crytic / crytic/crytic-compile

Add memoization when possible

Open
#128 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
197
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Some functions are heavily called by Slither, we should add memoization when possible to reduce the execution time. Example:

https://github.com/crytic/crytic-compile/blob/fe6d1ba8bdeacdda31439d60051fba9968e2e8b8/crytic_compile/crytic_compile.py#L231-L245

We could also consider adding a cache to some of the platforms properties, such as:
https://github.com/crytic/crytic-compile/blob/fe6d1ba8bdeacdda31439d60051fba9968e2e8b8/crytic_compile/platform/truffle.py#L268-L276

This requires benchmarking to ensure we improve the performance

We should add a generic way to enable/disable memoization in case the objects are modified by a script

Contributor guide

Open the contributing guide

Research direction

Start by reviewing crytic_compile/crytic_compile.py around lines 231-245 and crytic_compile/platform/truffle.py around lines 268-276. Benchmark the affected functions and platform properties before and after any memoization. Done means measurable execution-time improvement plus a generic way to enable or disable caching when objects may be modified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.