solady icon indicating copy to clipboard operation
solady copied to clipboard

✨ Added CLZ opcodes

Open atarpara opened this issue 2 months ago • 1 comments

Description

Don't merge till #1505.

Added src/utils/clz folder.

Checklist

Ensure you completed all of the steps below before submitting your pull request:

  • [x] Ran forge fmt?
  • [x] Ran forge test?

Pull requests with an incomplete checklist will be thrown out.

atarpara avatar Dec 03 '25 12:12 atarpara

CLZ-based gas optimizations across LibBit, FixedPointMathLib, and LibZip

Library Test function name Baseline CLZ Delta
LibBit testCLZ 306425 182223 −124202
testFFS 152619 108858 −43761
testFLS 254381 150002 −104379
testCommonBytePrefix 1572 659 −913
testCountZeroBytesDifferential(bytes) 8785 7053 −1732
FixedPointMathLib testLog2 265326 136107 −129219
testLog2Up 318958 159794 −159164
testLog10 75973 54880 −21093
testLog256 22804 12553 −10251
testCbrt 10279 7118 −3161
testSqrt 45390 33640 −11750
testLambertW0WadMonotonicallyIncreasing 18356886 17296838 −1060048
LibZip testABCCdCompressAndDecompressGas 3915 3534 −381
testABCStoreWithCdCompressGas 24857 24476 −381
testCdCompress 16684 14047 −2637
testCdFallback 3150724 3052584 −98140
testFlzCompressDecompress 2745055 2731401 −13654
testFlzCompressDecompress2 742732 735518 −7214
testCdFallbackDecompressor(bytes) 196686 194844 −1842
test__codesize 23664 23511 −153

atarpara avatar Dec 29 '25 09:12 atarpara