Cached checksumAddress
#2652
-
One option to speed it up would be to add an LRU cache that can potentially skip the expensive hash function when it gets a "hit". This implementation led to a 77x performance improvement.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
https://github.com/wevm/viem/blob/main/src/utils/address/getAddress.ts#L34 How does this improve performance by 77x? Update: I just realised that our LRU implementation doesn’t keep track of the keys touched to flush. Can update to fix. |
Beta Was this translation helpful? Give feedback.
checksumAddress
already has an LRU cache.https://github.com/wevm/viem/blob/main/src/utils/address/getAddress.ts#L34
How does this improve performance by 77x?
Update: I just realised that our LRU implementation doesn’t keep track of the keys touched to flush. Can update to fix.