Skip to content

Commit 7721dbb

Browse files
committed
Tweak reporting of libraries
1 parent 64a71cf commit 7721dbb

File tree

3 files changed

+86
-134
lines changed

3 files changed

+86
-134
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ Use the `run-libs.sh` script to compare different key-value store libraries:
8080
```
8181

8282
The benchmark auto-scales based on available RAM and caps at 1 million entries.
83-
Results are written to `target/benchmark/out-1.json` through `target/benchmark/out-6.json`
84-
along with human-readable logs in `target/benchmark/out-1.txt` through `target/benchmark/out-6.txt`.
83+
Results are written to `target/benchmark/out-libs-1.json` through `target/benchmark/out-libs-6.json`
84+
along with human-readable logs in `target/benchmark/out-libs-1.txt` through `target/benchmark/out-libs-6.txt`.
85+
8586

8687
### Generating Reports
8788

report-libs.sh

Lines changed: 66 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ XODUS_VERSION=$(get_version "xodus.version")
110110
CHRONICLE_VERSION=$(get_version "chronicle-map.version")
111111

112112
# Get benchmark date (before cd)
113-
BENCH_DATE=$(stat -c %y "$WORK_DIR/out-1.json" | cut -d' ' -f1)
113+
BENCH_DATE=$(stat -c %y "$WORK_DIR/out-libs-1.json" | cut -d' ' -f1)
114114

115115
# Detect benchmark mode by checking warmup iterations in the JSON
116-
WARMUP_ITERATIONS=$(jq -r '.[0].warmupIterations' "$WORK_DIR/out-1.json")
116+
WARMUP_ITERATIONS=$(jq -r '.[0].warmupIterations' "$WORK_DIR/out-libs-1.json")
117117
if [ "$WARMUP_ITERATIONS" = "0" ]; then
118118
BENCH_MODE="smoketest"
119119
else
@@ -249,7 +249,7 @@ jq -r '.[] | select(.benchmark | contains("LmdbJavaByteBuffer")) |
249249
select(.params.writeMap == "true") |
250250
(.benchmark | split(".")[-1]) as $bench |
251251
(if .params.forceSafe == "true" then "safe" else "unsafe" end) as $label |
252-
"\($bench)-\($label) \(.primaryMetric.score)"' out-1.json | sort > 1-forceSafe-reads.dat
252+
"\($bench)-\($label) \(.primaryMetric.score)"' out-libs-1.json | sort > 1-forceSafe-reads.dat
253253

254254
# Add color codes to the forceSafe data based on benchmark type
255255
awk '{
@@ -296,7 +296,7 @@ jq -r '.[] | select(.benchmark | contains(".write")) |
296296
elif . == "LmdbLwjgl" then "LMDB JGL"
297297
else . end) as $impl |
298298
(if .params.sync == "true" then "sync" else "nosync" end) as $sync |
299-
"\($impl) (\($sync)) \(.primaryMetric.score)"' out-1.json | sort > 1-sync-writes.dat
299+
"\($impl) (\($sync)) \(.primaryMetric.score)"' out-libs-1.json | sort > 1-sync-writes.dat
300300

301301
cat > 1-sync.gnuplot <<'GNUPLOT'
302302
set terminal svg size 800,600
@@ -329,7 +329,7 @@ jq -r '.[] | select(.benchmark | contains(".write")) |
329329
elif . == "LmdbLwjgl" then "LMDB JGL"
330330
else . end) as $impl |
331331
(if .params.writeMap == "true" then "wm" else "!wm" end) as $wmap |
332-
"\($impl) (\($wmap)) \(.primaryMetric.score)"' out-1.json | sort > 1-writeMap-writes.dat
332+
"\($impl) (\($wmap)) \(.primaryMetric.score)"' out-libs-1.json | sort > 1-writeMap-writes.dat
333333

334334
cat > 1-writeMap.gnuplot <<'GNUPLOT'
335335
set terminal svg size 800,600
@@ -392,7 +392,7 @@ echo "Processing Run 2: Page Boundary Alignment..."
392392

393393
# Run 2: Extract storage bytes from TXT file for random access
394394
# Line 159 from process.sh: grep 'sequential-false' out-2.tsv | grep 'after-close' | sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*-valSize-([0-9]+).*/\1 "\2 \3"/g' > 2-size.dat
395-
grep 'sequential-false' out-2.txt | grep 'after-close' | sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*-valSize-([0-9]+).*/\3|\2|\1/g' | \
395+
grep 'sequential-false' out-libs-2.txt | grep 'after-close' | sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*-valSize-([0-9]+).*/\3|\2|\1/g' | \
396396
sed 's/LmdbJavaAgrona/LMDB_DB/g' | \
397397
sed 's/LevelDb/LevelDB/g' | \
398398
sed 's/RocksDb/RocksDB/g' | \
@@ -458,7 +458,7 @@ jq -r '.[] | select(.benchmark | contains(".write")) |
458458
elif . == "RocksDb" then "RocksDB"
459459
else . end) as $impl |
460460
(.params.batchSize | tonumber / 1000000 | tostring) as $batch |
461-
"\($impl) \($batch)M \(.primaryMetric.score)"' out-3.json | \
461+
"\($impl) \($batch)M \(.primaryMetric.score)"' out-libs-3.json | \
462462
sort -k1,1 -k2,2n > 3-batchSize-writes.dat
463463

464464
cat > 3-batchSize.gnuplot <<'GNUPLOT'
@@ -518,12 +518,12 @@ EOF
518518
echo "Processing Run 4: All Libraries with 100 Byte Values..."
519519

520520
# Get the actual number of entries from Run 4
521-
NUM_ENTRIES=$(jq -r '.[0].params.num' out-4.json)
521+
NUM_ENTRIES=$(jq -r '.[0].params.num' out-libs-4.json)
522522
FLAT_ARRAY_SIZE=$((NUM_ENTRIES * 104))
523523

524524
# Extract storage size for intKey-true, sequential-false (random access)
525525
echo "${FLAT_ARRAY_SIZE} \"(Flat Array)\"" > 4-size-sorted.dat
526-
grep 'intKey-true-num-'${NUM_ENTRIES}'-sequential-false' out-4.txt | grep 'after-close' | \
526+
grep 'intKey-true-num-'${NUM_ENTRIES}'-sequential-false' out-libs-4.txt | grep 'after-close' | \
527527
sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*/\1|\2/g' | \
528528
sed 's/LmdbJavaAgrona/LMDB_DB/g' | \
529529
sed 's/LmdbJavaByteBuffer/LMDB_BB/g' | \
@@ -598,7 +598,7 @@ jq -r '.[] | select(.params.intKey == "true") |
598598
elif . == "MapDb" then "MapDB"
599599
elif . == "MvStore" then "MVStore"
600600
else . end) as $impl |
601-
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-4.json > 4-intKey-seq-all.dat
601+
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-libs-4.json > 4-intKey-seq-all.dat
602602

603603
# Split by benchmark type and remove benchmark prefix from labels
604604
for BENCH in readCrc readKey readRev readSeq readXxh32 write; do
@@ -667,7 +667,7 @@ jq -r '.[] | select(.params.intKey == "false") |
667667
elif . == "MapDb" then "MapDB"
668668
elif . == "MvStore" then "MVStore"
669669
else . end) as $impl |
670-
"false \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-4.json > 4-strKey-seq-all.dat
670+
"false \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-libs-4.json > 4-strKey-seq-all.dat
671671

672672
# Split by benchmark type and remove benchmark prefix from labels
673673
for BENCH in readCrc readKey readRev readSeq readXxh32 write; do
@@ -736,7 +736,7 @@ jq -r '.[] | select(.params.intKey == "true") |
736736
elif . == "MapDb" then "MapDB"
737737
elif . == "MvStore" then "MVStore"
738738
else . end) as $impl |
739-
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-4.json > 4-intKey-rnd-all.dat
739+
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-libs-4.json > 4-intKey-rnd-all.dat
740740

741741
# Split by benchmark type and remove benchmark prefix from labels
742742
for BENCH in readCrc readKey readRev readSeq readXxh32 write; do
@@ -805,7 +805,7 @@ jq -r '.[] | select(.params.intKey == "false") |
805805
elif . == "MapDb" then "MapDB"
806806
elif . == "MvStore" then "MVStore"
807807
else . end) as $impl |
808-
"false \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-4.json > 4-strKey-rnd-all.dat
808+
"false \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-libs-4.json > 4-strKey-rnd-all.dat
809809

810810
# Split by benchmark type and remove benchmark prefix from labels
811811
for BENCH in readCrc readKey readRev readSeq readXxh32 write; do
@@ -927,12 +927,12 @@ EOF
927927
echo "Processing Run 5: Large Value Testing..."
928928

929929
# Get the actual number of entries from Run 5
930-
NUM_ENTRIES_5=$(jq -r '.[0].params.num' out-5.json)
930+
NUM_ENTRIES_5=$(jq -r '.[0].params.num' out-libs-5.json)
931931
FLAT_ARRAY_SIZE_5=$((NUM_ENTRIES_5 * 2030))
932932

933933
# Extract storage size for Run 5 (intKey-true, sequential-false, valSize=2026)
934934
echo "${FLAT_ARRAY_SIZE_5} \"(Flat Array)\"" > 5-size-sorted.dat
935-
grep 'intKey-true-num-'${NUM_ENTRIES_5}'-sequential-false.*valSize-2026' out-5.txt | grep 'after-close' | \
935+
grep 'intKey-true-num-'${NUM_ENTRIES_5}'-sequential-false.*valSize-2026' out-libs-5.txt | grep 'after-close' | \
936936
sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*/\1|\2/g' | \
937937
sed 's/LmdbJavaAgrona/LMDB_DB/g' | \
938938
sed 's/LmdbJavaByteBuffer/LMDB_BB/g' | \
@@ -1007,7 +1007,7 @@ jq -r '.[] | select(.params.intKey == "true") |
10071007
elif . == "RocksDb" then "RocksDB"
10081008
elif . == "MapDb" then "MapDB"
10091009
else . end) as $impl |
1010-
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-5.json > 5-intKey-seq-all.dat
1010+
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-libs-5.json > 5-intKey-seq-all.dat
10111011

10121012
# Split by benchmark type and remove benchmark prefix from labels
10131013
for BENCH in readKey readSeq write; do
@@ -1064,7 +1064,7 @@ jq -r '.[] | select(.params.intKey == "true") |
10641064
elif . == "RocksDb" then "RocksDB"
10651065
elif . == "MapDb" then "MapDB"
10661066
else . end) as $impl |
1067-
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-5.json > 5-intKey-rnd-all.dat
1067+
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-libs-5.json > 5-intKey-rnd-all.dat
10681068

10691069
# Split by benchmark type and remove benchmark prefix from labels
10701070
for BENCH in readKey readSeq write; do
@@ -1153,7 +1153,7 @@ EOF
11531153
echo "Processing Run 6: Very Large Value Testing..."
11541154

11551155
# Get the actual number of entries from Run 6
1156-
NUM_ENTRIES_6=$(jq -r '.[0].params.num' out-6.json)
1156+
NUM_ENTRIES_6=$(jq -r '.[0].params.num' out-libs-6.json)
11571157

11581158
# Process each value size (4080, 8176, 16368)
11591159
for VALSIZE in 4080 8176 16368; do
@@ -1162,7 +1162,7 @@ for VALSIZE in 4080 8176 16368; do
11621162

11631163
# Extract storage size for this value size
11641164
echo "${FLAT_ARRAY_SIZE} \"(Flat Array)\"" > 6-size-${VALSIZE}-sorted.dat
1165-
grep "intKey-true-num-${NUM_ENTRIES_6}-sequential-false.*valSize-${VALSIZE}" out-6.txt | grep 'after-close' | \
1165+
grep "intKey-true-num-${NUM_ENTRIES_6}-sequential-false.*valSize-${VALSIZE}" out-libs-6.txt | grep 'after-close' | \
11661166
sed -r 's/Bytes\tafter-close\t([0-9]+)\torg.lmdbjava.bench.([a-z|A-Z]+).*/\1|\2/g' | \
11671167
sed 's/LmdbJavaAgrona/LMDB_DB/g' | \
11681168
sed 's/LevelDb/LevelDB/g' | \
@@ -1229,7 +1229,7 @@ GNUPLOT
12291229
elif . == "LevelDb" then "LevelDB"
12301230
elif . == "RocksDb" then "RocksDB"
12311231
else . end) as $impl |
1232-
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-6.json > 6-intKey-rnd-${VALSIZE}-all.dat
1232+
"true \"\($bench).\($impl)\" false \(.primaryMetric.score)"' out-libs-6.json > 6-intKey-rnd-${VALSIZE}-all.dat
12331233

12341234
# Split by benchmark type and remove benchmark prefix from labels
12351235
for BENCH in readKey readSeq write; do
@@ -1407,7 +1407,7 @@ jq -r '.[] | select(.params.intKey == "true") |
14071407
elif . == "MapDb" then "MapDB"
14081408
elif . == "MvStore" then "MVStore"
14091409
else . end) as $impl |
1410-
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-4.json > summary-all.dat
1410+
"true \"\($bench).\($impl)\" true \(.primaryMetric.score)"' out-libs-4.json > summary-all.dat
14111411

14121412
for BENCH in readCrc readKey readRev readSeq readXxh32 write; do
14131413
grep "\"${BENCH}\." summary-all.dat | sed "s/\"${BENCH}\./\"/g" > 4-intKey-seq-${BENCH}.dat
@@ -1487,123 +1487,70 @@ EOF
14871487

14881488
echo "Generating HTML viewer..."
14891489

1490-
# Create simple HTML viewer that uses marked.js to render README.md
1490+
# Create HTML viewer with GitHub markdown CSS and markdown-it
14911491
cat > index.html <<'HTML'
14921492
<!DOCTYPE html>
14931493
<html lang="en">
14941494
<head>
14951495
<meta charset="UTF-8">
14961496
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14971497
<title>LmdbJava Benchmarks Report</title>
1498-
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
1498+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.5.1/github-markdown.min.css">
14991499
<style>
15001500
body {
1501-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
1502-
line-height: 1.6;
1503-
max-width: 1200px;
1501+
box-sizing: border-box;
1502+
min-width: 200px;
1503+
max-width: 980px;
15041504
margin: 0 auto;
1505-
padding: 20px;
1506-
color: #333;
1505+
padding: 45px;
15071506
background: #f5f5f5;
15081507
}
1509-
#content {
1508+
.markdown-body {
1509+
box-sizing: border-box;
15101510
background: white;
15111511
padding: 40px;
15121512
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
15131513
}
1514-
h2 {
1515-
color: #2c3e50;
1516-
border-bottom: 2px solid #3498db;
1517-
padding-bottom: 10px;
1518-
margin-top: 40px;
1519-
}
1520-
h3 {
1521-
color: #34495e;
1522-
margin-top: 30px;
1523-
}
1524-
h4 {
1525-
color: #555;
1526-
margin-top: 20px;
1527-
}
1528-
table {
1529-
border-collapse: collapse;
1530-
width: 100%;
1531-
margin: 20px 0;
1532-
}
1533-
th, td {
1534-
border: 1px solid #ddd;
1535-
padding: 12px;
1536-
text-align: left;
1537-
}
1538-
th {
1539-
background-color: #3498db;
1540-
color: white;
1541-
}
1542-
tr:nth-child(even) {
1543-
background-color: #f9f9f9;
1544-
}
1545-
code {
1546-
background: #f4f4f4;
1547-
padding: 2px 6px;
1548-
border-radius: 3px;
1549-
font-family: 'Courier New', monospace;
1550-
}
1551-
pre {
1552-
background: #f4f4f4;
1553-
padding: 15px;
1554-
border-radius: 5px;
1555-
overflow-x: auto;
1556-
}
1557-
pre code {
1558-
background: transparent;
1559-
padding: 0;
1560-
}
1561-
img {
1562-
max-width: 100%;
1563-
height: auto;
1564-
display: block;
1565-
margin: 20px auto;
1566-
}
1567-
ul {
1568-
margin: 15px 0;
1569-
}
1570-
li {
1571-
margin: 8px 0;
1572-
}
1573-
a {
1574-
color: #3498db;
1575-
text-decoration: none;
1576-
}
1577-
a:hover {
1578-
text-decoration: underline;
1579-
}
15801514
</style>
15811515
</head>
15821516
<body>
1583-
<div id="content">Loading report...</div>
1584-
<script>
1585-
fetch('README.md')
1586-
.then(response => {
1587-
if (!response.ok) throw new Error('Failed to load README.md');
1588-
return response.text();
1589-
})
1590-
.then(text => {
1591-
document.getElementById('content').innerHTML = marked.parse(text);
1592-
})
1593-
.catch(error => {
1594-
document.getElementById('content').innerHTML =
1595-
'<div style="padding: 40px; background: #fff3cd; border: 2px solid #856404; border-radius: 8px;">' +
1596-
'<h2 style="color: #856404; margin-top: 0;">⚠️ Cannot Load Report</h2>' +
1597-
'<p>The report cannot be loaded when opening <code>index.html</code> directly as a file.</p>' +
1598-
'<p><strong>To view this report, run a local web server:</strong></p>' +
1599-
'<pre style="background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto;">' +
1600-
'cd target/benchmark\n' +
1601-
'python3 -m http.server 8000\n' +
1602-
'</pre>' +
1603-
'<p>Then open <a href="http://localhost:8000">http://localhost:8000</a> in your browser</p>' +
1604-
'<p style="margin-top: 30px;"><strong>Alternatively:</strong> View <code>README.md</code> directly in any markdown viewer or on GitHub</p>' +
1605-
'</div>';
1606-
});
1517+
<div class="markdown-body" id="content">Loading report...</div>
1518+
<script type="module">
1519+
import markdownit from 'https://cdn.jsdelivr.net/npm/markdown-it@14/+esm';
1520+
const md = markdownit();
1521+
1522+
// Check if we're running from file://
1523+
if (window.location.protocol === 'file:') {
1524+
document.getElementById('content').innerHTML = `
1525+
<div style="padding: 40px; background: #fff3cd; border: 2px solid #856404; border-radius: 8px;">
1526+
<h2 style="color: #856404; margin-top: 0;">⚠️ Cannot Load Report</h2>
1527+
<p>The report cannot be loaded when opening <code>index.html</code> directly as a file.</p>
1528+
<p><strong>To view this report, run a local web server:</strong></p>
1529+
<pre style="background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto;">cd target/benchmark
1530+
python3 -m http.server 8000</pre>
1531+
<p>Then open <a href="http://localhost:8000">http://localhost:8000</a> in your browser</p>
1532+
<p style="margin-top: 30px;"><strong>Alternatively:</strong> View <code>README.md</code> directly in any markdown viewer or on GitHub</p>
1533+
</div>
1534+
`;
1535+
} else {
1536+
fetch('README.md')
1537+
.then(response => {
1538+
if (!response.ok) throw new Error('Failed to load README.md');
1539+
return response.text();
1540+
})
1541+
.then(text => {
1542+
document.getElementById('content').innerHTML = md.render(text);
1543+
})
1544+
.catch(error => {
1545+
document.getElementById('content').innerHTML = `
1546+
<div style="padding: 40px; background: #fff3cd; border: 2px solid #856404; border-radius: 8px;">
1547+
<h2 style="color: #856404; margin-top: 0;">⚠️ Error Loading Report</h2>
1548+
<p>Failed to load README.md: ${error.message}</p>
1549+
<p><strong>Alternatively:</strong> View <code>README.md</code> directly in any markdown viewer</p>
1550+
</div>
1551+
`;
1552+
});
1553+
}
16071554
</script>
16081555
</body>
16091556
</html>

0 commit comments

Comments
 (0)