We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca87869 commit cb0c8dbCopy full SHA for cb0c8db
src/EVM.hs
@@ -2953,7 +2953,10 @@ writeMemory memory offset buf = do
2953
expandMemory targetSize = do
2954
let toAlloc = targetSize - VUnboxed.Mutable.length memory
2955
if toAlloc > 0 then do
2956
- memory' <- VUnboxed.Mutable.grow memory toAlloc
+ -- always grow at least 8k, to avoid the performance impact
2957
+ -- that would happen with repeated small expansion operations,
2958
+ -- as grow does a larger *copy* of the vector on a new place
2959
+ memory' <- VUnboxed.Mutable.grow memory $ max toAlloc 8192
2960
assign (#state % #memory) (ConcreteMemory memory')
2961
pure memory'
2962
else
0 commit comments