MoKaBench Plans

ยท

2 min read

I have plans of creating a benchmark framework for MoKa Reads that will help compare different metrics of programming languages against each other. Here are some of the metrics we'd leak to observe:

  1. Compilation time: How long it takes to compile a program

  2. Execution speed: How long it takes for a program to run

    • Can be tested for different optimization modes along with different flags
  3. Binary size: How big are the outputted binary is

  4. Memory usage: How efficiently the language uses memory

What sort of programs can help test these metrics?

  • Recursion using fibonacci sequence

  • Hello world

  • JSON parsing

  • Matrix operations with generics

  • Matrix operations with floats

  • Huge Dynamic array

    • Test pushing, searching, and sorting
  • Huge HashMap

    • Test inserting, get, remove, updating
  • Calculating Pi to 1,000,000th digit using Chudnovsky algorithm

  • RK4 algorithm to approximate IVPs

  • Secant method to estimate roots in a function

  • Stochastic simulation algorithm to model chemical reactions

    • Requires random numbers

Languages

Here is a list of languages we hope to include into our benchmark suite:

  • C (all)

  • C++ (all)

  • Zig (all)

  • Rust (all)

  • Swift (2-4)

  • Go (all)

  • Java (2-4)

  • Python (2-4)

Organization

We hope to organize in the following manner:

suite/ 
    bencher.something
    suite.json
    outputs.txt 
    # for example huge dynamic array...
    huge_dyn_array/
        zig/
            huge_dyn_arr_gpa.zig # uses general purpose allocator
            huge_dyn_arr_page.zig # uses page allocator 
            huge_dyn_arr_c.zig # uses malloc 
        c/
            huge_dyn_arr.c 
        rust/ 
            huge_dyn_arr.rs 
        ...

We hope in suite.json to be able to define parameters such as how many samples, warm up time, flags for different languages, etc.

Did you find this article valuable?

Support MoKa Reads Blog by becoming a sponsor. Any amount is appreciated!

ย