Evaluate performance gains to expect when EVM were to compile hot contracts into machine code

Related tags

Command-line jitevm
Overview

JIT-EVM Experiments

Goal

Evaluate performance gains to expect when EVM were to compile hot contracts into machine code (rather than interpreting the EVM bytecode)

Todos

  • Support all instructions
  • Performance evaluation
  • Error handling
  • Gas accounting

Experiment (MacOS, see Ubuntu below)

Setup:

  • LLVM 14 installed with brew in /opt/homebrew/opt/llvm

Run:

LLVM_SYS_140_PREFIX=/opt/homebrew/opt/llvm cargo run

What it does:

  • Fibonacci sequence calculator hand-implemented in EVM bytecode
  • Runs it in EVM interpreter
  • Compiles it to machine code and executes it
  • You compare that the outputs correspond to the 15th Fibonacci number (which is 377)

How to interpret the output:

  • Modulo indexing convention, 15th Fibonacci number is 377 (says Google)
  • Last line of demo output (this is from JIT VM): return value is 377
  • Scrolling up past the LLVM IR: last state of interpreter has 377 in the 0th stack entry

Tests (MacOS, see Ubuntu below)

RUST_BACKTRACE=1 LLVM_SYS_140_PREFIX=/opt/homebrew/opt/llvm RUST_MIN_STACK=8388608 cargo test -- --nocapture

Ubuntu

Install:

sudo apt-get install llvm-14 llvm-14-dev libllvm14

Adjust paths above accordingly (leaving LLVM_SYS_140_PREFIX=/opt/homebrew/opt/llvm away entirely "works for me").

References

You might also like...
ChatGPT powered Rust proc macro that generates code at compile-time.

gpt-macro ChatGPT powered Rust proc macro that generates code at compile-time. Implemented Macros auto_impl!{} #[auto_test(...)] Usage Get ChatGPT API

Catch Tailwindcss Errors  at Compile-Time Before They Catch You, without making any change to your code!  Supports overriding, extending, custom classes, custom modifiers, Plugins and many more 🚀🔥🦀
Catch Tailwindcss Errors at Compile-Time Before They Catch You, without making any change to your code! Supports overriding, extending, custom classes, custom modifiers, Plugins and many more 🚀🔥🦀

twust Twust is a powerful static checker in rust for TailwindCSS class names at compile-time. Table of Contents Overview Installation Usage Statement

CLI for ERC-5564 compliant stealth address management on evm chains

stealthereum-cli This is a bare bones CLI written in rust for ERC-5564 compliant stealth address management on evm chains It's currently the easiest w

My solutions for the 2021 edition of the Advent of Code, using Rust and SOM (Simple Object Machine)

Advent of Code 2021 These are my solutions for the 2021 edition of the Advent of Code. The solutions are all implemented using both Rust and SOM (Simp

batch eval tool for machine code. eval() but for asm.

yaxpeax-eval yaxpeax-eval is the repo providing yaxeval, a tool to execute machine code with preconditions and report state at exit. currently, yaxeva

Blockoli is a high-performance tool for code indexing, embedding generation and semantic search tool for use with LLMs.
Blockoli is a high-performance tool for code indexing, embedding generation and semantic search tool for use with LLMs.

blockoli 🥦🔎 Blockoli is a high-performance tool for code indexing, embedding generation and semantic search tool for use with LLMs. blockoli is buil

A strong, compile-time enforced authorization framework for rust applications.

DACquiri A compile-time enforced authorization framework for Rust applications. Authorization In typical applications, authorization checks are perfor

Utilites for working with `bevy_ecs` when not all types are known at compile time

bevy_ecs_dynamic Utilities for working with bevy_ecs in situations where the types you're dealing with might not be known at compile time (e.g. script

tidy-builder is a builder generator that is compile-time correct.
tidy-builder is a builder generator that is compile-time correct.

The Builder derive macro creates a compile-time correct builder which means that it only allows you to build the given struct if and only if you provi

Owner
Paradigm
A research-driven technology investment firm.
Paradigm
ObfusEval is the benchmarking tool to evaluate the reliability of the code obfuscating transformation.

ObfusEval ObfusEval is the benchmarking tool to evaluate the reliability of the code obfuscating transformation. The following two metrics related the

Software Engineering Lab @ NAIST 4 Dec 15, 2022
This is a tool to evaluate or export code from Markdown files.

Evaluate Markdown This is a tool to evaluate or export code from Markdown files. Why? Because I like writing Markdown files with code snippets (it's g

Balazs Nadasdi 5 Apr 25, 2023
A filesystem driver that allows you to view your Blackboard course contents as if they were normal files and folders on your system!

BlackboardFS Blackboard: noun A website so bad that it might as well be a network drive. BlackboardFS is a filesystem driver that allows you to view y

null 22 Sep 4, 2023
DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support.

DeFiCh/octopus DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support . Proposed as a DFI

DeFi Meta Chain 6 Apr 18, 2022
RustHopper evaluate grasshopper3d with RhinoCompute from Rust.

RustHopper This is a crate to run grasshopper with RhinoCompute from rust. The input data can be created by entering into main.rs the same Python code

hiron 11 Jan 1, 2023
Evaluate LLM-generated COBOL

COBOLEval: LLM Evaluation for COBOL COBOLEval is a dataset to evaluate the code generation abilities of Large Language Models on the COBOL programming

Bloop AI 22 Jun 26, 2024
CLI tool to bake your fresh and hot MD files

At least once in your Rust dev lifetime you wanted to make sure all code examples in your markdown files are up-to-date, correct and code is formated, but you couldn't make that done with already existing tools - fear not!

Patryk Budzyński 39 May 8, 2021
Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and at compile-time.

rgb2ansi256 rgb2ansi256 is a small Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and const fn. Th

Linda_pp 7 Nov 17, 2022
A series of crates that I made to compile images/video into asciinema & play them.

Bad Apple A series of crates that I made to compile images/video into asciinema & play them. The end goal is to make a kernel & legacy bootloader that

S0ra 10 Nov 29, 2022
Stockbook embeds 1-bit raster images in your code at compile time

stockbook Stockbook embeds 1-bit raster images in your code at compile time. Designed primarily for #![no_std] usage, in embedded or other program-mem

Karol Belina 3 Oct 27, 2022