@@ -96,9 +96,23 @@ CHRONICLE_VERSION=$(get_version "chronicle-map.version")
9696# Get benchmark date (before cd)
9797BENCH_DATE=$( stat -c %y " $WORK_DIR /out-1.json" | cut -d' ' -f1)
9898
99+ # Detect benchmark mode by checking warmup iterations in the JSON
100+ WARMUP_ITERATIONS=$( jq -r ' .[0].warmupIterations' " $WORK_DIR /out-1.json" )
101+ if [ " $WARMUP_ITERATIONS " = " 0" ]; then
102+ BENCH_MODE=" smoketest"
103+ else
104+ BENCH_MODE=" benchmark"
105+ fi
106+
99107# Change to working directory to generate all files there
100108cd " $WORK_DIR "
101109
110+ echo " Benchmark Mode: $BENCH_MODE "
111+ if [ " $BENCH_MODE " = " smoketest" ]; then
112+ echo " WARNING: Smoketest results are for verification only, not performance comparison"
113+ fi
114+ echo " "
115+
102116echo " System Information:"
103117echo " CPU: $CPU_MODEL (${CPU_COUNT} cores)"
104118echo " RAM: ${RAM_GB} GB"
@@ -129,6 +143,26 @@ available to Java applications. The benchmark tests various workload sizes with
129143RAM-based auto-scaling (capped at 1 million entries), testing different value
130144sizes, access patterns, and implementation-specific configurations.
131145
146+ EOF
147+
148+ # Add smoketest warning if applicable
149+ if [ " $BENCH_MODE " = " smoketest" ]; then
150+ cat >> README.md << 'EOF '
151+ > **⚠️ SMOKETEST RESULTS**
152+ >
153+ > This report was generated from a **smoketest run** and should NOT be used for
154+ > performance comparisons or production decisions. Smoketest results have:
155+ > - **No warmup iterations** (JVM not optimized)
156+ > - **Single iteration** (no statistical validity)
157+ > - **Minimal entry counts** (1K entries only)
158+ > - **Short runtime** (quick verification only)
159+ >
160+ > For valid performance results, run `./run.sh benchmark` instead.
161+
162+ EOF
163+ fi
164+
165+ cat >> README.md << EOF
132166## Methodology
133167
134168The benchmark was executed on ${BENCH_DATE} using
@@ -201,7 +235,20 @@ jq -r '.[] | select(.benchmark | contains("LmdbJavaByteBuffer")) |
201235 (if .params.forceSafe == "true" then "safe" else "unsafe" end) as $label |
202236 "\($bench)-\($label) \(.primaryMetric.score)"' out-1.json | sort > 1-forceSafe-reads.dat
203237
204- # Create gnuplot script for forceSafe
238+ # Add color codes to the forceSafe data based on benchmark type
239+ awk ' {
240+ bench = $1;
241+ value = $2;
242+ if (bench ~ /^readCrc-/) color = "0xe41a1c";
243+ else if (bench ~ /^readKey-/) color = "0x984ea3";
244+ else if (bench ~ /^readRev-/) color = "0xffff33";
245+ else if (bench ~ /^readSeq-/) color = "0x377eb8";
246+ else if (bench ~ /^readXxh32-/) color = "0x4daf4a";
247+ else color = "0x000000";
248+ print bench, value, color;
249+ }' 1-forceSafe-reads.dat > 1-forceSafe-colored.dat
250+
251+ # Create gnuplot script for forceSafe with individual colors per bar
205252cat > 1-forceSafe.gnuplot << 'GNUPLOT '
206253set terminal svg size 800,600
207254set output '1-forceSafe-reads.svg'
@@ -212,11 +259,11 @@ set style fill solid 0.25 border
212259set boxwidth 0.5
213260set xtics nomirror rotate by -270
214261set grid y
215- plot '1-forceSafe-reads .dat' using 2: xtic(1) with boxes notitle
262+ plot '1-forceSafe-colored .dat' using 0:2:3: xtic(1) with boxes lc rgbcolor variable notitle
216263GNUPLOT
217264
218265gnuplot 1-forceSafe.gnuplot
219- rm 1-forceSafe.gnuplot
266+ rm -f 1-forceSafe.gnuplot 1-forceSafe-colored.dat
220267
221268echo " Generated 1-forceSafe-reads.svg"
222269
@@ -245,7 +292,7 @@ set style fill solid 0.25 border
245292set boxwidth 0.5
246293set xtics nomirror rotate by -270
247294set grid y
248- plot '1-sync-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes notitle
295+ plot '1-sync-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes lc rgb "#ff7f00" notitle
249296GNUPLOT
250297
251298gnuplot 1-sync.gnuplot
@@ -278,7 +325,7 @@ set style fill solid 0.25 border
278325set boxwidth 0.5
279326set xtics nomirror rotate by -270
280327set grid y
281- plot '1-writeMap-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes notitle
328+ plot '1-writeMap-writes.dat' using 4:xticlabels(sprintf("%s %s %s", stringcolumn(1), stringcolumn(2), stringcolumn(3))) with boxes lc rgb "#ff7f00" notitle
282329GNUPLOT
283330
284331gnuplot 1-writeMap.gnuplot
@@ -408,7 +455,7 @@ set style fill solid 0.25 border
408455set boxwidth 0.5
409456set xtics nomirror rotate by -270
410457set grid y
411- plot '3-batchSize-writes.dat' using 3:xticlabels(sprintf("%s %s", stringcolumn(1), stringcolumn(2))) with boxes notitle
458+ plot '3-batchSize-writes.dat' using 3:xticlabels(sprintf("%s %s", stringcolumn(1), stringcolumn(2))) with boxes lc rgb "#ff7f00" notitle
412459GNUPLOT
413460
414461gnuplot 3-batchSize.gnuplot
@@ -1517,12 +1564,29 @@ cat > index.html <<'HTML'
15171564 </style >
15181565</head >
15191566<body >
1520- <div id =" content" ></div >
1567+ <div id =" content" >Loading report... </div >
15211568 <script >
15221569 fetch (' README.md' )
1523- .then (response => response .text ())
1570+ .then (response => {
1571+ if (! response .ok ) throw new Error (' Failed to load README.md' );
1572+ return response .text ();
1573+ })
15241574 .then (text => {
15251575 document .getElementById (' content' ).innerHTML = marked .parse (text);
1576+ })
1577+ .catch (error => {
1578+ document .getElementById (' content' ).innerHTML =
1579+ ' <div style="padding: 40px; background: #fff3cd; border: 2px solid #856404; border-radius: 8px;">' +
1580+ ' <h2 style="color: #856404; margin-top: 0;">⚠️ Cannot Load Report</h2>' +
1581+ ' <p>The report cannot be loaded when opening <code>index.html</code> directly as a file.</p>' +
1582+ ' <p><strong>To view this report, run a local web server:</strong></p>' +
1583+ ' <pre style="background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto;">' +
1584+ ' cd target/benchmark\n ' +
1585+ ' python3 -m http.server 8000\n ' +
1586+ ' </pre>' +
1587+ ' <p>Then open <a href="http://localhost:8000">http://localhost:8000</a> in your browser</p>' +
1588+ ' <p style="margin-top: 30px;"><strong>Alternatively:</strong> View <code>README.md</code> directly in any markdown viewer or on GitHub</p>' +
1589+ ' </div>' ;
15261590 });
15271591 </script >
15281592</body >
@@ -1558,7 +1622,12 @@ echo " - 6-size-16368.svg and 6-size-16368.md"
15581622echo " - 6-intKey-rnd-16368.svg"
15591623echo " - summary.svg"
15601624echo " "
1561- echo " To view the report, open $WORK_DIR /index.html in your web browser"
1625+ echo " To view the HTML report:"
1626+ echo " cd $WORK_DIR "
1627+ echo " python3 -m http.server 8000"
1628+ echo " Then open http://localhost:8000 in your browser"
1629+ echo " "
1630+ echo " Alternatively, view README.md directly in your markdown viewer"
15621631echo " "
15631632echo " IMPORTANT: The generated README.md is a template based on the benchmark data."
15641633echo " Please review it carefully for correctness and adjust the commentary as needed"
0 commit comments