From 1cdeb90beb0d04db5cd4c0f88906ab8a5585b11a Mon Sep 17 00:00:00 2001 From: rubensworks Date: Tue, 25 Aug 2026 18:33:29 +0000 Subject: [PATCH] Add performance benchmarking setup Measures what Integrated Crafting adds on top of an Integrated Dynamics network: crafting interfaces, crafting job scheduling and execution, and the network's recipe index. Mirrors the setup of Integrated Dynamics and Integrated Tunnels, and reuses ID's measurement infrastructure. Adds eight benchmark presets on a shared cable grid: three idle presets that isolate the standing cost of crafting interfaces and of crafting writers that have nothing to do, three active presets that continuously craft (flat, dependency-resolving, and with a 2.45x larger recipe index at constant crafting work), and two topology churn presets. All presets are also exposed through /integratedcrafting generatecrafting for manual profiling in a real world. Every preset asserts after warmup that none of its parts is deactivated or in an aspect error state, and that every filled recipe slot is valid, so that a preset cannot silently degrade into an expensive no-op. Storage chests are deliberately only filled two thirds: a crafting interface buffers its results until it can push them into network storage and stops ticking its jobs entirely while that buffer is non-empty, so full chests jam every interface after a single craft. Without PERFORMANCE_BENCHMARK_ENABLED, all benchmark game tests succeed immediately without generating anything. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01DF81jeWnWNR3ECHzNd9mRh --- .github/parse_benchmark_results.sh | 74 ++ .gitignore | 3 + PERFORMANCE_BENCHMARKING.md | 278 ++++++ .../IntegratedCrafting.java | 14 + .../command/CommandGenerateCrafting.java | 818 ++++++++++++++++++ .../gametest/GameTestsPerformance.java | 260 ++++++ 6 files changed, 1447 insertions(+) create mode 100755 .github/parse_benchmark_results.sh create mode 100644 PERFORMANCE_BENCHMARKING.md create mode 100644 src/main/java/org/cyclops/integratedcrafting/command/CommandGenerateCrafting.java create mode 100644 src/main/java/org/cyclops/integratedcrafting/gametest/GameTestsPerformance.java diff --git a/.github/parse_benchmark_results.sh b/.github/parse_benchmark_results.sh new file mode 100755 index 000000000..23ef0bbc8 --- /dev/null +++ b/.github/parse_benchmark_results.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# Parse benchmark results from game tests and convert to JSON format +# This script reads the benchmark results file and converts it to JSON format +# for use with benchmark-action/github-action-benchmark + +set -e + +BENCH_FILE="benchmark_results.json" +RESULTS_FILE="runs/gameTestServer/logs/benchmark_results.txt" + +echo "Parsing benchmark results..." + +# Initialize the JSON array +echo "[" > "$BENCH_FILE" + +# Default values if file doesn't exist +if [ ! -f "$RESULTS_FILE" ]; then + echo "Benchmark results file not found at $RESULTS_FILE" + exit 1; +fi + +FIRST=true +while IFS= read -r line; do + # Skip empty lines + if [ -z "$line" ]; then + continue + fi + + # Parse the line: preset= size= avgNetworkTickTime=