#!/usr/bin/env bash # Reproduces every measurement behind the ankurm.com GraalVM native images post. # Requires: JAVA_HOME pointed at a plain JDK 25 for the JVM steps, and a separate GraalVM # distribution (with the bundled native-image tool) for the native steps -- see docs/00-versions.md. set -euo pipefail cd "$(dirname "$0")/.." echo "== 1. plain JVM baseline ==" "$JDK25_HOME/bin/java" -jar target/app.jar --server.port=8081 & JPID=$! sleep 5 curl -s localhost:8081/hello; echo ps -o rss= -p $JPID kill $JPID echo "== 2. build the native image (mvn -Pnative native:compile) ==" mvn -Pnative -DskipTests native:compile echo "== 3. run the native image, reflection trap included ==" ./target/graalvm-native-images --server.port=8082 & NPID=$! sleep 1 curl -s "localhost:8082/report?format=plain"; echo ps -o rss= -p $NPID kill $NPID