Skip to content

📝 Plan for CLZ opcode #1417

@Vectorized

Description

@Vectorized

In the future, when the CLZ opcode https://eips.ethereum.org/EIPS/eip-7939 is added, many algorithms in Solady can be drastically improved upon.

Libraries such as LibBit, LibBytes, LibString, FixedPointMathLib, LibZip can see a dramatic speedup.

CLZ can be the highest impact improvement to accelerate the EVM for the next 2 years:

  • More so than transient storage (can be substituted with using warm slots).
  • More so than PUSH0 (can be substituted with other 2 gas opcodes).
  • LibZip.cdCompress will be more widely used to pack storage automatically. This uses CLZ repeatedly.

To enable maximum support and backwards compatibility:

  • Once the CLZ opcode appears on mainnet, the corresponding library will be in the future directory (e.g. utils/future).
  • Let's also take the opportunity to introduce stuff like MCOPY (e.g. for insertion sort).
  • When most L2s have the CLZ opcode, we may decide to move the libraries from future into the actual directory. Then, the non CLZ libraries will be moved into the legacy directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions