Use this skill when the user wants to run performance benchmarks, compare languages, or test the compute-average-income implementations.

8 stars
1 forks
Rust
3 views

SKILL.md

run-benchmarks

Use this skill when the user wants to run performance benchmarks, compare languages, or test the compute-average-income implementations.

Instructions

  1. Set JAVA_HOME to Java 23 for Gradle compatibility:

    export JAVA_HOME=/Users/tnfink/Library/Java/JavaVirtualMachines/openjdk-23.0.1/Contents/Home
    
  2. Run all benchmarks with:

    ./gradlew computeAverageIncome
    

    Or run individual language benchmarks:

    • Kotlin: ./gradlew computeAverageIncomeKotlin
    • GraalVM: ./gradlew computeAverageIncomeGraalVM (requires GRAALVM_HOME)
    • Rust: ./gradlew computeAverageIncomeRust
    • Haskell: ./gradlew computeAverageIncomeHaskell
  3. For Haskell profiling:

    ./gradlew profileAverageIncomeHaskell
    

Notes

  • Gradle 9.2.1 uses JDK 21 toolchain (auto-provisioned via foojay)
  • GraalVM benchmark requires GRAALVM_HOME environment variable set
  • Haskell uses GHC 9.10.3 (LTS-24.25)
  • Rust uses cargo with --release flag

README

What's this?

This code contains examples used in these blog articles:

Overall Requirements.

Java in Version 23 specified by JAVA_HOME. (Version 25 is not supported Gradle.)

An installed GraalVM specified by GRAALVM_HOME.

Kotlin

The Kotlin example is built and run using Gradle.

./gradlew computeAverageIncome

Rust

You need at least the version 1.46.0 of rustc to build this example.

To build and run the Rust application you have to move to its project directory:

cd src/main/rust/compute_average_income

Running the slow development Rust version:

cargo run

Running the fast Rust version:

cargo run --release

Haskell

You need an installation of Stack.

To build and run the Haskell benchmark:

./gradlew computeAverageIncomeHaskell

GraalVM

./gradlew computeAverageIncomeGraalVM

Run all benchmarks

First you have to install everything needed for the individual benchmarks. Then you can start all at once:

./gradlew computeAverageIncome