Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] cheap moveimm #683

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[WIP] cheap moveimm #683

wants to merge 1 commit into from

Conversation

akiramenai
Copy link
Collaborator

Code Review Checklist

Purpose

Ticket Number

Requirements

  • Have the requirements been met?
  • Have stakeholder(s) approved the change?

Implementation

  • Does this code change accomplish what it is supposed to do?
  • Can this solution be simplified?
  • Does this change add unwanted compile-time or run-time dependencies?
  • Could an additional framework, API, library, or service improve the solution?
  • Could we reuse part of LLVM instead of implementing the patch or a part of it?
  • Is the code at the right abstraction level?
  • Is the code modular enough?
  • Can a better solution be found in terms of maintainability, readability, performance, or security?
  • Does similar functionality already exist in the codebase? If yes, why isn’t it reused?
  • Are there any best practices, design patterns or language-specific patterns that could substantially improve this code?

Logic Errors and Bugs

  • Can you think of any use case in which the
    code does not behave as intended?
  • Can you think of any inputs or external events
    that could break the code?

Error Handling and Logging

  • Is error handling done the correct way?
  • Should any logging or debugging information
    be added or removed?
  • Are error messages user-friendly?
  • Are there enough log events and are they
    written in a way that allows for easy
    debugging?

Maintainability

  • Is the code easy to read?
  • Is the code not repeated (DRY Principle)?
  • Is the code method/class not too long?

Dependencies

  • Were updates to documentation, configuration, or readme files made as required by this change?
  • Are there any potential impacts on other parts of the system or backward compatibility?

Security

  • Does the code introduce any security vulnerabilities?

Performance

  • Do you think this code change decreases
    system performance?
  • Do you see any potential to improve the
    performance of the code significantly?

Testing and Testability

  • Is the code testable?
  • Have automated tests been added, or have related ones been updated to cover the change?
    • For changes to mutable state
  • Do tests reasonably cover the code change (unit/integration/system tests)?
    • Line Coverage
    • Region Coverage
    • Branch Coverage
  • Are there some test cases, input or edge cases
    that should be tested in addition?

Readability

  • Is the code easy to understand?
  • Which parts were confusing to you and why?
  • Can the readability of the code be improved by
    smaller methods?
  • Can the readability of the code be improved by
    different function, method or variable names?
  • Is the code located in the right
    file/folder/package?
  • Do you think certain methods should be
    restructured to have a more intuitive control
    flow?
  • Is the data flow understandable?
  • Are there redundant or outdated comments?
  • Could some comments convey the message
    better?
  • Would more comments make the code more
    understandable?
  • Could some comments be removed by making the code itself more readable?
  • Is there any commented-out code?
  • Have you run a spelling and grammar checker?

Documentation

  • Is there sufficient documentation?
  • Is the ReadMe.md file up to date?

Best Practices

  • Follow Single Responsibility principle?
  • Are different errors handled correctly?
  • Are errors and warnings logged?
  • Magic values avoided?
  • No unnecessary comments?
  • Minimal nesting used?

Experts' Opinion

  • Do you think a specific expert, like a security
    expert or a usability expert, should look over
    the code before it can be accepted?
  • Will this code change impact different teams, and should they review the change as well?

Copy link

Benchmark results default:

╔═╡ Size (-%) ╞════════════════╡ All M3B3 ╞═╗
║ Mean                                0.001 ║
║ Best                               30.303 ║
║ Worst                             -14.173 ║
║ Total                              -0.046 ║
╠═╡ Cycles (-%) ╞══════════════╡ All M3B3 ╞═╣
║ Mean                               -0.112 ║
║ Best                                5.941 ║
║ Worst                             -11.666 ║
║ Total                              -0.039 ║
╠═╡ Ergs (-%) ╞════════════════╡ All M3B3 ╞═╣
║ Mean                               -0.011 ║
║ Best                                4.517 ║
║ Worst                              -8.967 ║
║ Total                              -0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════════════╡ All MzB3 ╞═╗
║ Mean                               -0.044 ║
║ Best                               29.703 ║
║ Worst                             -20.513 ║
║ Total                               0.040 ║
╠═╡ Cycles (-%) ╞══════════════╡ All MzB3 ╞═╣
║ Mean                               -0.165 ║
║ Best                               10.714 ║
║ Worst                             -28.386 ║
║ Total                              -0.045 ║
╠═╡ Ergs (-%) ╞════════════════╡ All MzB3 ╞═╣
║ Mean                               -0.033 ║
║ Best                                6.513 ║
║ Worst                             -21.729 ║
║ Total                              -0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter M3B3 ╞═╣
║ Mean                               -0.096 ║
║ Best                                0.000 ║
║ Worst                              -0.276 ║
║ Total                              -0.045 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╣
║ Mean                                0.001 ║
║ Best                                0.005 ║
║ Worst                              -0.055 ║
║ Total                               0.000 ║
╠═╡ Ergs/gas ╞══════╡ EVMInterpreter M3B3 ╞═╣
║ ADD                                42.750 ║
║ MUL                                25.650 ║
║ SUB                                42.750 ║
║ DIV                                30.450 ║
║ SDIV                               46.050 ║
║ MOD                                30.450 ║
║ SMOD                               43.650 ║
║ ADDMOD                             24.406 ║
║ MULMOD                             25.906 ║
║ EXP                                 7.438 ║
║ SIGNEXTEND                         28.050 ║
║ LT                                 46.750 ║
║ GT                                 46.750 ║
║ SLT                                70.750 ║
║ SGT                                68.750 ║
║ EQ                                 46.750 ║
║ ISZERO                             44.417 ║
║ AND                                42.750 ║
║ OR                                 42.750 ║
║ XOR                                42.750 ║
║ NOT                                38.417 ║
║ BYTE                               54.750 ║
║ SHL                                46.750 ║
║ SHR                                48.750 ║
║ SAR                                68.750 ║
║ SGT                                68.750 ║
║ SHA3                               28.243 ║
║ ADDRESS                            53.812 ║
║ BALANCE                            73.390 ║
║ ORIGIN                           1349.625 ║
║ CALLER                             53.812 ║
║ CALLVALUE                          53.812 ║
║ CALLDATALOAD                       40.750 ║
║ CALLDATASIZE                       54.125 ║
║ CALLDATACOPY                       73.123 ║
║ CODESIZE                           54.625 ║
║ CODECOPY                          133.379 ║
║ GASPRICE                         1352.438 ║
║ EXTCODESIZE                         5.130 ║
║ EXTCODECOPY                         5.182 ║
║ RETURNDATASIZE                     52.500 ║
║ RETURNDATACOPY                     45.222 ║
║ EXTCODEHASH                         6.214 ║
║ BLOCKHASH                         241.019 ║
║ COINBASE                         1352.625 ║
║ TIMESTAMP                        1349.625 ║
║ NUMBER                           1349.625 ║
║ PREVRANDAO                       1349.625 ║
║ GASLIMIT                         1355.625 ║
║ CHAINID                          1349.625 ║
║ SELFBALANCE                       642.075 ║
║ BASEFEE                          1349.625 ║
║ POP                                44.625 ║
║ MLOAD                              64.390 ║
║ MSTORE                             62.562 ║
║ MSTORE8                            74.127 ║
║ SLOAD                              26.837 ║
║ SSTORE                              9.059 ║
║ JUMP                               23.111 ║
║ JUMPI                              21.727 ║
║ PC                                 54.312 ║
║ MSIZE                              60.812 ║
║ GAS                                51.312 ║
║ JUMPDEST                           77.625 ║
║ PUSH0                              51.312 ║
║ PUSH1                              45.958 ║
║ PUSH2                              49.375 ║
║ PUSH4                              52.208 ║
║ PUSH5                              53.625 ║
║ PUSH6                              55.042 ║
║ PUSH7                              56.458 ║
║ PUSH8                              57.875 ║
║ PUSH9                              59.292 ║
║ PUSH10                             60.708 ║
║ PUSH11                             62.125 ║
║ PUSH12                             63.542 ║
║ PUSH13                             64.958 ║
║ PUSH14                             66.375 ║
║ PUSH15                             67.792 ║
║ PUSH16                             69.208 ║
║ PUSH17                             70.625 ║
║ PUSH18                             72.042 ║
║ PUSH19                             73.458 ║
║ PUSH20                             74.875 ║
║ PUSH21                             76.292 ║
║ PUSH22                             77.708 ║
║ PUSH23                             79.125 ║
║ PUSH24                             80.542 ║
║ PUSH25                             81.958 ║
║ PUSH26                             83.375 ║
║ PUSH27                             84.792 ║
║ PUSH28                             86.208 ║
║ PUSH29                             87.625 ║
║ PUSH30                             89.042 ║
║ PUSH31                             90.458 ║
║ PUSH32                             89.875 ║
║ DUP1                               36.417 ║
║ DUP2                               44.417 ║
║ DUP3                               42.417 ║
║ DUP4                               44.417 ║
║ DUP5                               44.417 ║
║ DUP6                               44.417 ║
║ DUP7                               44.417 ║
║ DUP8                               44.417 ║
║ DUP9                               44.417 ║
║ DUP10                              44.417 ║
║ DUP11                              44.417 ║
║ DUP12                              44.417 ║
║ DUP13                              44.417 ║
║ DUP14                              44.417 ║
║ DUP15                              44.417 ║
║ DUP16                              44.417 ║
║ SWAP1                              47.083 ║
║ SWAP2                              47.083 ║
║ SWAP3                              47.083 ║
║ SWAP4                              47.083 ║
║ SWAP5                              45.083 ║
║ SWAP6                              47.083 ║
║ SWAP7                              47.083 ║
║ SWAP8                              47.083 ║
║ SWAP9                              47.083 ║
║ SWAP10                             47.083 ║
║ SWAP11                             47.083 ║
║ SWAP12                             47.083 ║
║ SWAP13                             47.083 ║
║ SWAP14                             47.083 ║
║ SWAP15                             47.083 ║
║ SWAP16                             47.083 ║
║ CALL                               56.182 ║
║ STATICCALL                         56.172 ║
║ DELEGATECALL                       55.208 ║
║ CREATE                              5.034 ║
║ CREATE2                             7.054 ║
║ RETURN                              1.000 ║
║ REVERT                              1.000 ║
╠═╡ Ergs/gas (-%) ╞═╡ EVMInterpreter M3B3 ╞═╣
║ BALANCE                            -0.078 ║
║ ORIGIN                             -0.009 ║
║ GASPRICE                           -0.009 ║
║ EXTCODESIZE                        -0.045 ║
║ EXTCODECOPY                        -0.044 ║
║ EXTCODEHASH                        -0.124 ║
║ COINBASE                           -0.009 ║
║ TIMESTAMP                          -0.009 ║
║ NUMBER                             -0.009 ║
║ PREVRANDAO                         -0.009 ║
║ GASLIMIT                           -0.009 ║
║ CHAINID                            -0.009 ║
║ SELFBALANCE                         0.008 ║
║ BASEFEE                            -0.009 ║
║ CALL                               -0.007 ║
║ STATICCALL                         -0.007 ║
║ DELEGATECALL                       -0.007 ║
║ CREATE                             -0.008 ║
║ CREATE2                            -0.009 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter MzB3 ╞═╣
║ Mean                               -0.096 ║
║ Best                                0.000 ║
║ Worst                              -0.276 ║
║ Total                              -0.045 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╣
║ Mean                                0.001 ║
║ Best                                0.005 ║
║ Worst                              -0.055 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles M3B3 ╞═╗
║ Mean                                0.189 ║
║ Best                                0.576 ║
║ Worst                               0.000 ║
║ Total                               0.230 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles M3B3 ╞═╣
║ Mean                               -0.115 ║
║ Best                                0.000 ║
║ Worst                              -2.151 ║
║ Total                              -0.002 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles M3B3 ╞═╣
║ Mean                               -0.015 ║
║ Best                                0.000 ║
║ Worst                              -1.993 ║
║ Total                              -0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles MzB3 ╞═╣
║ Mean                                0.037 ║
║ Best                                2.685 ║
║ Worst                              -0.209 ║
║ Total                               0.001 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles MzB3 ╞═╣
║ Mean                                0.113 ║
║ Best                                2.332 ║
║ Worst                              -0.015 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life M3B3 ╞═╗
║ Mean                               -0.006 ║
║ Best                                0.727 ║
║ Worst                              -0.905 ║
║ Total                               0.020 ║
╠═╡ Cycles (-%) ╞════════╡ Real life M3B3 ╞═╣
║ Mean                               -0.034 ║
║ Best                                1.573 ║
║ Worst                              -2.740 ║
║ Total                               0.060 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life M3B3 ╞═╣
║ Mean                                0.011 ║
║ Best                                0.752 ║
║ Worst                              -0.251 ║
║ Total                               0.017 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life MzB3 ╞═╗
║ Mean                               -0.087 ║
║ Best                                2.614 ║
║ Worst                              -1.635 ║
║ Total                               0.082 ║
╠═╡ Cycles (-%) ╞════════╡ Real life MzB3 ╞═╣
║ Mean                                0.383 ║
║ Best                                6.250 ║
║ Worst                              -1.065 ║
║ Total                              -0.191 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life MzB3 ╞═╣
║ Mean                                0.049 ║
║ Best                                3.758 ║
║ Worst                              -0.895 ║
║ Total                              -0.050 ║
╚═══════════════════════════════════════════╝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant