diff --git a/report-cursoriterable.sh b/report-cursoriterable.sh new file mode 100755 index 0000000..49affcf --- /dev/null +++ b/report-cursoriterable.sh @@ -0,0 +1,307 @@ +#!/bin/bash +# +# Copyright © 2016-2025 The LmdbJava Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -euo pipefail + +# Pure HTML report generator for LmdbJava version regression testing + +# Source common functions +source "$(dirname "$0")/report-common.sh" + +DATA_DIR="target/benchmark-cursoriterable" +WORK_DIR="target/benchmark" + +# Check prerequisites +JSON_COUNT=$(find "$DATA_DIR" -name "out-*.json" 2>/dev/null | wc -l) +if [ $JSON_COUNT -lt 2 ]; then + echo "ERROR: Need at least 2 version benchmark result files in $DATA_DIR" + exit 1 +fi + +echo "Found ${JSON_COUNT} version benchmark results" + +# Get system info +CPU_MODEL=$(get_cpu_info) +CPU_COUNT=$(get_cpu_count) +RAM_GIB=$(get_total_ram_gib) +KERNEL=$(get_kernel) +JAVA_TAG=$(get_java_version) + +FIRST_FILE=$(find "$DATA_DIR" \( -name "out-*.json" \) 2>/dev/null | head -1) +BENCH_DATE=$(stat -c %y "$FIRST_FILE" | cut -d' ' -f1) +BENCH_MODE=$(get_benchmark_mode "$FIRST_FILE") + +mkdir -p "$WORK_DIR" +cp "$DATA_DIR"/out-*.json "$WORK_DIR/" 2>/dev/null || true + +cd "$WORK_DIR" + +# List all files +FILES=$(find . -name "*.json" -type f | sort) + +## Build version list +#VERSIONS=() +#for f in $FILES; do +# [ -f "$f" ] || continue +# VERSION=$(echo "$f" | sed 's/out-\(.*\)\-version-\(.*\)\.json/\2/' | sed 's/out-\(.*\)\-branch-\(.*\)\.json/branch-\2/') +# VERSIONS+=("$VERSION") +#done + +echo "Processing benchmarks and generating chart..." + +# Extract data and generate chart +for BENCH in all allBackward atLeast atLeastBackward atMost atMostBackward closed closedBackward closedOpen closedOpenBackward greaterThan greaterThanBackward lessThan lessThanBackward open openBackward openClosed openClosedBackward; do + > "vers-${BENCH}.dat" + for FILE in ${FILES}; do +# if [[ "$VERSION" == branch-* ]]; then +# FILE="out-${VERSION}.json" +# else +# FILE="out-version-${VERSION}.json" +# fi + [ -f "$FILE" ] || continue + VERSION=$(echo "$FILE" | sed 's/\(.*\)\-version-\(.*\)\.json/\2/' | sed 's/\(.*\)\-branch-\(.*\)\.json/branch-\2/') + SCORE=$(jq -r ".[] | select(.benchmark | contains(\"LmdbJavaCursorIterable.${BENCH}\")) | + select(.params.intKey == \"true\") | select(.params.sequential == \"true\") | + .primaryMetric.score" "$FILE" 2>/dev/null || echo "") + if [ -n "$SCORE" ]; then + if [[ "$VERSION" == branch-* ]]; then + BRANCH_PART=$(echo "$VERSION" | sed 's/branch-\([^#]*\)#.*/\1/' | cut -c1-6) + GIT_PART=$(echo "$VERSION" | sed 's/.*#\(.*\)/\1/') + VERSION_LABEL="${BRANCH_PART}#${GIT_PART}" + else + VERSION_LABEL="$VERSION" + fi + echo "\"${VERSION_LABEL}\" ${SCORE}" >> "vers-${BENCH}.dat" + fi + done +done + +cat > vers-multiplot.gnuplot <<'GNUPLOT' +set terminal svg size 1000,6000 noenhanced +set output 'version-comparison.svg' +set style fill solid 0.25 border +set boxwidth 0.5 +set grid y +set multiplot layout 9,2 title "LmdbJava Performance Regression Testing\nMilliseconds per Operation (Smaller is Better)" +set ylabel "ms / operation" +set xlabel "" +set xtics nomirror rotate by -270 + +set title "all" +plot 'vers-all.dat' using 2:xtic(1) with boxes lc rgb "#F44336" notitle +set title "allBackward" +plot 'vers-allBackward.dat' using 2:xtic(1) with boxes lc rgb "#E91E63" notitle +set title "atLeast" +plot 'vers-atLeast.dat' using 2:xtic(1) with boxes lc rgb "#9C27B0" notitle +set title "atLeastBackward" +plot 'vers-atLeastBackward.dat' using 2:xtic(1) with boxes lc rgb "#673AB7" notitle +set title "atMost" +plot 'vers-atMost.dat' using 2:xtic(1) with boxes lc rgb "#3F51B5" notitle +set title "atMostBackward" +plot 'vers-atMostBackward.dat' using 2:xtic(1) with boxes lc rgb "#2196F3" notitle +set title "closed" +plot 'vers-closed.dat' using 2:xtic(1) with boxes lc rgb "#03A9F4" notitle +set title "closedBackward" +plot 'vers-closedBackward.dat' using 2:xtic(1) with boxes lc rgb "#00BCD4" notitle +set title "closedOpen" +plot 'vers-closedOpen.dat' using 2:xtic(1) with boxes lc rgb "#009688" notitle +set title "closedOpenBackward" +plot 'vers-closedOpenBackward.dat' using 2:xtic(1) with boxes lc rgb "#4CAF50" notitle +set title "greaterThan" +plot 'vers-greaterThan.dat' using 2:xtic(1) with boxes lc rgb "#8BC34A" notitle +set title "greaterThanBackward" +plot 'vers-greaterThanBackward.dat' using 2:xtic(1) with boxes lc rgb "#CDDC39" notitle +set title "lessThan" +plot 'vers-lessThan.dat' using 2:xtic(1) with boxes lc rgb "#FFEB3B" notitle +set title "lessThanBackward" +plot 'vers-lessThanBackward.dat' using 2:xtic(1) with boxes lc rgb "#FFC107" notitle +set title "open" +plot 'vers-open.dat' using 2:xtic(1) with boxes lc rgb "#FF9800" notitle +set title "openBackward" +plot 'vers-openBackward.dat' using 2:xtic(1) with boxes lc rgb "#FF5722" notitle +set title "openClosed" +plot 'vers-openClosed.dat' using 2:xtic(1) with boxes lc rgb "#795548" notitle +set title "openClosedBackward" +plot 'vers-openClosedBackward.dat' using 2:xtic(1) with boxes lc rgb "#607D8B" notitle +unset multiplot +GNUPLOT + +gnuplot vers-multiplot.gnuplot +rm -f vers-multiplot.gnuplot vers-*.dat + +echo "Generating HTML report..." + +# Generate pure HTML report +emit_html_header "LmdbJava Performance Regression Testing" > index.html +echo "
The following tables show each benchmark ranked by performance, with percentage difference from the fastest version.
+ Branch versions (e.g., master#65df2ee) are highlighted in bold.
| Rank | Version | ms/op | vs Fastest |
|---|---|---|---|
| $RANK | $VERSION_DISPLAY | $SCORE_FMT | $DIFF |
$VERSION$VERSIONThe benchmark was executed on ${BENCH_DATE} using + LmdbJava Benchmarks.
+ +All tests use the ByteBuffer implementation with the following configuration:
+ +EOHTML + +# Emit system environment without LmdbJava version (pass empty strings) +emit_system_environment "$CPU_MODEL" "$CPU_COUNT" "$RAM_GIB" "$KERNEL" "$JAVA_TAG" >> index.html + +cat >> index.html <<'EOHTML' + +