/optimizooors-lab

Measure gas savings with different optimizations

Primary LanguageSolidityApache License 2.0Apache-2.0

🧪 Optimizooor's Lab

Welcome to the 🧪 Optimizooor's Lab!

Optimize code and run tests with our equipment for optimizooors:

  • GFlask: An instrument for measuring gas savings with different optimizations
  • MyLab: An environment for running controlled experiments

Findings

function method0() public unoptimized {
    uint256 i;
    i += 1;
}

// ------------------------------------

function method1() public optimized {
    uint256 i;
    ++i;
}

function method2() public optimized {
    uint256 i;
    i = i + 1;
}

function method3() public optimized {
    uint256 i;
    i++;
}
  ::: 1
  SAVES (GAS): 3
  PERCENT (%): 3.33
  
  ::: 2
  No savings.
  
  ::: 3
  [!] More expensive (gas): -2

Proof-of-concept

Proof-of-concept Golf Course reimagined with our GFlask and a golf theme.

Instructions

Download foundryup

curl -L https://foundry.paradigm.xyz | bash

Install Foundry

foundryup

Create a new project using our template

forge init --template https://github.com/ZeroEkkusu/optimizooors-lab my_lab

... or install as a dependency

forge install https://github.com/ZeroEkkusu/optimizooors-lab