@blinklabs/dingo 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PLUGIN_DEVELOPMENT.md +7 -0
- package/README.md +0 -1
- package/dingo.yaml.example +0 -2
- package/generate_benchmarks.sh +103 -57
- package/package.json +1 -1
package/PLUGIN_DEVELOPMENT.md
CHANGED
|
@@ -14,6 +14,13 @@ Store blockchain data (blocks, transactions, etc.). Examples:
|
|
|
14
14
|
- `gcs` - Google Cloud Storage
|
|
15
15
|
- `s3` - AWS S3
|
|
16
16
|
|
|
17
|
+
#### Iterator lifetime note
|
|
18
|
+
Blob plugins expose iterators via `NewIterator(txn, opts)`. Items returned by the
|
|
19
|
+
iterator's `Item()` must only be accessed while the transaction used to create
|
|
20
|
+
the iterator is still active — implementations may validate transaction state at
|
|
21
|
+
access time and will return errors if the transaction has been committed or
|
|
22
|
+
rolled back. See `database/types/types.go` `BlobIterator` for details.
|
|
23
|
+
|
|
17
24
|
### Metadata Storage Plugins
|
|
18
25
|
Store metadata and indexes. Examples:
|
|
19
26
|
- `sqlite` - SQLite relational database
|
package/README.md
CHANGED
|
@@ -112,7 +112,6 @@ Each plugin supports specific configuration options. See `dingo.yaml.example` fo
|
|
|
112
112
|
- `bucket` - GCS bucket name
|
|
113
113
|
- `project-id` - Google Cloud project ID
|
|
114
114
|
- `prefix` - Path prefix within bucket
|
|
115
|
-
- `credentials-file` - Path to service account credentials file (optional - uses Application Default Credentials if not provided)
|
|
116
115
|
|
|
117
116
|
**AWS S3 Options:**
|
|
118
117
|
- `bucket` - S3 bucket name
|
package/dingo.yaml.example
CHANGED
package/generate_benchmarks.sh
CHANGED
|
@@ -134,17 +134,20 @@ parse_benchmark() {
|
|
|
134
134
|
echo "$formatted_name|$ops_sec|$time_op|$mem_op|$allocs_op"
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
# Parse current results into
|
|
138
|
-
|
|
137
|
+
# Parse current results into temporary file
|
|
138
|
+
CURRENT_RESULTS_FILE=$(mktemp "${TMPDIR:-/tmp}/dingo_bench_XXXXXX")
|
|
139
139
|
while IFS= read -r line; do
|
|
140
140
|
if [[ "$line" =~ ^Benchmark ]]; then
|
|
141
141
|
parsed=$(parse_benchmark "$line")
|
|
142
142
|
name=$(echo "$parsed" | cut -d'|' -f1)
|
|
143
143
|
data=$(echo "$parsed" | cut -d'|' -f2-)
|
|
144
|
-
|
|
144
|
+
echo "$name|$data" >> "$CURRENT_RESULTS_FILE"
|
|
145
145
|
fi
|
|
146
146
|
done <<< "$BENCHMARK_OUTPUT"
|
|
147
147
|
|
|
148
|
+
# Deduplicate benchmark names
|
|
149
|
+
sort -t'|' -k1,1 -u "$CURRENT_RESULTS_FILE" > "$CURRENT_RESULTS_FILE.tmp" && mv "$CURRENT_RESULTS_FILE.tmp" "$CURRENT_RESULTS_FILE"
|
|
150
|
+
|
|
148
151
|
# Display current results summary
|
|
149
152
|
echo "Current Benchmark Summary"
|
|
150
153
|
echo "-------------------------"
|
|
@@ -172,7 +175,8 @@ echo "$BENCHMARK_OUTPUT" | grep "^Benchmark" | sort -k5 -nr | head -3 | while re
|
|
|
172
175
|
done
|
|
173
176
|
|
|
174
177
|
# Read previous results if file exists and we're comparing
|
|
175
|
-
|
|
178
|
+
PREVIOUS_RESULTS_FILE=$(mktemp "${TMPDIR:-/tmp}/dingo_bench_XXXXXX")
|
|
179
|
+
trap 'rm -f "$CURRENT_RESULTS_FILE" "$PREVIOUS_RESULTS_FILE"' EXIT
|
|
176
180
|
previous_date=""
|
|
177
181
|
MAJOR_CHANGES=false
|
|
178
182
|
|
|
@@ -201,7 +205,7 @@ if [[ -f "$OUTPUT_FILE" && "$WRITE_TO_FILE" == "true" ]]; then
|
|
|
201
205
|
mem_op=$(echo "$line" | sed 's/^| //' | cut -d'|' -f4 | sed 's/ //g')
|
|
202
206
|
allocs_op=$(echo "$line" | sed 's/^| //' | cut -d'|' -f5 | sed 's/ //g')
|
|
203
207
|
if [[ -n "$benchmark" && -n "$ops_sec" ]]; then
|
|
204
|
-
|
|
208
|
+
echo "$benchmark|$ops_sec|$time_op|$mem_op|$allocs_op" >> "$PREVIOUS_RESULTS_FILE"
|
|
205
209
|
fi
|
|
206
210
|
fi
|
|
207
211
|
if [[ "$in_table" == true && "$line" == "" ]]; then
|
|
@@ -210,20 +214,42 @@ if [[ -f "$OUTPUT_FILE" && "$WRITE_TO_FILE" == "true" ]]; then
|
|
|
210
214
|
done < "$OUTPUT_FILE"
|
|
211
215
|
fi
|
|
212
216
|
|
|
217
|
+
# Deduplicate previous benchmark names
|
|
218
|
+
sort -t'|' -k1,1 -u "$PREVIOUS_RESULTS_FILE" > "$PREVIOUS_RESULTS_FILE.tmp" && mv "$PREVIOUS_RESULTS_FILE.tmp" "$PREVIOUS_RESULTS_FILE"
|
|
219
|
+
|
|
220
|
+
# Helper functions to get data from temp files
|
|
221
|
+
get_current_data() {
|
|
222
|
+
local benchmark="$1"
|
|
223
|
+
awk -F'|' '$1 == "'"$benchmark"'" {print substr($0, index($0, "|")+1)}' "$CURRENT_RESULTS_FILE"
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
get_previous_data() {
|
|
227
|
+
local benchmark="$1"
|
|
228
|
+
awk -F'|' '$1 == "'"$benchmark"'" {print substr($0, index($0, "|")+1)}' "$PREVIOUS_RESULTS_FILE"
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
list_current_benchmarks() {
|
|
232
|
+
awk -F'|' '!seen[$1]++ {print $1}' "$CURRENT_RESULTS_FILE"
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
list_previous_benchmarks() {
|
|
236
|
+
awk -F'|' '!seen[$1]++ {print $1}' "$PREVIOUS_RESULTS_FILE"
|
|
237
|
+
}
|
|
238
|
+
|
|
213
239
|
# Generate performance comparison if we have previous results
|
|
214
240
|
if [[ -n "$previous_date" && "$WRITE_TO_FILE" == "true" ]]; then
|
|
215
241
|
# Track changes
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
242
|
+
faster_benchmarks=""
|
|
243
|
+
slower_benchmarks=""
|
|
244
|
+
new_benchmarks=""
|
|
245
|
+
removed_benchmarks=""
|
|
220
246
|
|
|
221
247
|
# Compare results
|
|
222
|
-
|
|
223
|
-
if [[ -n "$
|
|
248
|
+
while IFS= read -r benchmark; do
|
|
249
|
+
if [[ -n "$(get_previous_data "$benchmark")" ]]; then
|
|
224
250
|
# Benchmark exists in both
|
|
225
|
-
current_data
|
|
226
|
-
previous_data
|
|
251
|
+
current_data=$(get_current_data "$benchmark")
|
|
252
|
+
previous_data=$(get_previous_data "$benchmark")
|
|
227
253
|
|
|
228
254
|
current_ops=$(echo "$current_data" | cut -d'|' -f1)
|
|
229
255
|
previous_ops=$(echo "$previous_data" | cut -d'|' -f1)
|
|
@@ -231,31 +257,41 @@ if [[ -n "$previous_date" && "$WRITE_TO_FILE" == "true" ]]; then
|
|
|
231
257
|
if [[ "$current_ops" =~ ^[0-9]+$ && "$previous_ops" =~ ^[0-9]+$ && $previous_ops -gt 0 ]]; then
|
|
232
258
|
change=$(( (current_ops - previous_ops) * 100 / previous_ops ))
|
|
233
259
|
if [[ $change -gt 10 ]]; then
|
|
234
|
-
faster_benchmarks
|
|
260
|
+
faster_benchmarks="$faster_benchmarks
|
|
261
|
+
$benchmark (+${change}%)"
|
|
235
262
|
elif [[ $change -lt -10 ]]; then
|
|
236
263
|
change_abs=$(( (previous_ops - current_ops) * 100 / previous_ops ))
|
|
237
|
-
slower_benchmarks
|
|
264
|
+
slower_benchmarks="$slower_benchmarks
|
|
265
|
+
$benchmark (-${change_abs}%)"
|
|
238
266
|
MAJOR_CHANGES=true
|
|
239
267
|
fi
|
|
240
268
|
fi
|
|
241
269
|
else
|
|
242
|
-
new_benchmarks
|
|
270
|
+
new_benchmarks="$new_benchmarks
|
|
271
|
+
$benchmark"
|
|
243
272
|
fi
|
|
244
|
-
done
|
|
273
|
+
done < <(list_current_benchmarks)
|
|
245
274
|
|
|
246
275
|
# Check for removed benchmarks
|
|
247
|
-
|
|
248
|
-
if [[ -z "$
|
|
249
|
-
removed_benchmarks
|
|
276
|
+
while IFS= read -r benchmark; do
|
|
277
|
+
if [[ -z "$(get_current_data "$benchmark")" ]]; then
|
|
278
|
+
removed_benchmarks="$removed_benchmarks
|
|
279
|
+
$benchmark"
|
|
250
280
|
fi
|
|
251
|
-
done
|
|
281
|
+
done < <(list_previous_benchmarks)
|
|
282
|
+
|
|
283
|
+
# Count items (remove empty lines and count)
|
|
284
|
+
faster_count=$(echo "$faster_benchmarks" | sed '/^$/d' | wc -l)
|
|
285
|
+
slower_count=$(echo "$slower_benchmarks" | sed '/^$/d' | wc -l)
|
|
286
|
+
new_count=$(echo "$new_benchmarks" | sed '/^$/d' | wc -l)
|
|
287
|
+
removed_count=$(echo "$removed_benchmarks" | sed '/^$/d' | wc -l)
|
|
252
288
|
|
|
253
289
|
echo ""
|
|
254
290
|
echo "Performance Changes Summary:"
|
|
255
|
-
echo " Faster: $
|
|
291
|
+
echo " Faster: $faster_count | Slower: $slower_count | New: $new_count | Removed: $removed_count"
|
|
256
292
|
|
|
257
293
|
# Report changes if any improvements, regressions, or new benchmarks detected
|
|
258
|
-
if [[ $
|
|
294
|
+
if [[ $faster_count -gt 0 || $slower_count -gt 0 || $new_count -gt 0 ]]; then
|
|
259
295
|
MAJOR_CHANGES=true
|
|
260
296
|
fi
|
|
261
297
|
fi
|
|
@@ -285,17 +321,17 @@ if [[ "$WRITE_TO_FILE" == "true" ]]; then
|
|
|
285
321
|
echo ""
|
|
286
322
|
|
|
287
323
|
# Track changes
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
324
|
+
faster_benchmarks=""
|
|
325
|
+
slower_benchmarks=""
|
|
326
|
+
new_benchmarks=""
|
|
327
|
+
removed_benchmarks=""
|
|
292
328
|
|
|
293
329
|
# Compare results
|
|
294
|
-
|
|
295
|
-
if [[ -n "$
|
|
330
|
+
while IFS= read -r benchmark; do
|
|
331
|
+
if [[ -n "$(get_previous_data "$benchmark")" ]]; then
|
|
296
332
|
# Benchmark exists in both
|
|
297
|
-
current_data
|
|
298
|
-
previous_data
|
|
333
|
+
current_data=$(get_current_data "$benchmark")
|
|
334
|
+
previous_data=$(get_previous_data "$benchmark")
|
|
299
335
|
|
|
300
336
|
current_ops=$(echo "$current_data" | cut -d'|' -f1)
|
|
301
337
|
previous_ops=$(echo "$previous_data" | cut -d'|' -f1)
|
|
@@ -303,52 +339,62 @@ if [[ "$WRITE_TO_FILE" == "true" ]]; then
|
|
|
303
339
|
if [[ "$current_ops" =~ ^[0-9]+$ && "$previous_ops" =~ ^[0-9]+$ && $previous_ops -gt 0 ]]; then
|
|
304
340
|
if [[ $current_ops -gt $previous_ops ]]; then
|
|
305
341
|
change=$(( (current_ops - previous_ops) * 100 / previous_ops ))
|
|
306
|
-
faster_benchmarks
|
|
342
|
+
faster_benchmarks="$faster_benchmarks
|
|
343
|
+
$benchmark (+${change}%)"
|
|
307
344
|
elif [[ $current_ops -lt $previous_ops ]]; then
|
|
308
345
|
change=$(( (previous_ops - current_ops) * 100 / previous_ops ))
|
|
309
|
-
slower_benchmarks
|
|
346
|
+
slower_benchmarks="$slower_benchmarks
|
|
347
|
+
$benchmark (-${change}%)"
|
|
310
348
|
fi
|
|
311
349
|
fi
|
|
312
350
|
else
|
|
313
|
-
new_benchmarks
|
|
351
|
+
new_benchmarks="$new_benchmarks
|
|
352
|
+
$benchmark"
|
|
314
353
|
fi
|
|
315
|
-
done
|
|
354
|
+
done < <(list_current_benchmarks)
|
|
316
355
|
|
|
317
356
|
# Check for removed benchmarks
|
|
318
|
-
|
|
319
|
-
if [[ -z "$
|
|
320
|
-
removed_benchmarks
|
|
357
|
+
while IFS= read -r benchmark; do
|
|
358
|
+
if [[ -z "$(get_current_data "$benchmark")" ]]; then
|
|
359
|
+
removed_benchmarks="$removed_benchmarks
|
|
360
|
+
$benchmark"
|
|
321
361
|
fi
|
|
322
|
-
done
|
|
362
|
+
done < <(list_previous_benchmarks)
|
|
363
|
+
|
|
364
|
+
# Count items
|
|
365
|
+
faster_count=$(echo "$faster_benchmarks" | sed '/^$/d' | wc -l)
|
|
366
|
+
slower_count=$(echo "$slower_benchmarks" | sed '/^$/d' | wc -l)
|
|
367
|
+
new_count=$(echo "$new_benchmarks" | sed '/^$/d' | wc -l)
|
|
368
|
+
removed_count=$(echo "$removed_benchmarks" | sed '/^$/d' | wc -l)
|
|
323
369
|
|
|
324
370
|
echo "### Summary"
|
|
325
|
-
echo "- **Faster benchmarks**: $
|
|
326
|
-
echo "- **Slower benchmarks**: $
|
|
327
|
-
echo "- **New benchmarks**: $
|
|
328
|
-
echo "- **Removed benchmarks**: $
|
|
371
|
+
echo "- **Faster benchmarks**: $faster_count"
|
|
372
|
+
echo "- **Slower benchmarks**: $slower_count"
|
|
373
|
+
echo "- **New benchmarks**: $new_count"
|
|
374
|
+
echo "- **Removed benchmarks**: $removed_count"
|
|
329
375
|
echo ""
|
|
330
376
|
|
|
331
|
-
if [[ $
|
|
377
|
+
if [[ $faster_count -gt 0 ]]; then
|
|
332
378
|
echo "### Top Improvements"
|
|
333
|
-
|
|
379
|
+
echo "$faster_benchmarks" | grep "^." | sort -t'(' -k2 -nr | head -5 | sed 's/^/- /'
|
|
334
380
|
echo ""
|
|
335
381
|
fi
|
|
336
382
|
|
|
337
|
-
if [[ $
|
|
383
|
+
if [[ $slower_count -gt 0 ]]; then
|
|
338
384
|
echo "### Performance Regressions"
|
|
339
|
-
|
|
385
|
+
echo "$slower_benchmarks" | grep "^." | sort -t'(' -k2 -nr | head -5 | sed 's/^/- /'
|
|
340
386
|
echo ""
|
|
341
387
|
fi
|
|
342
388
|
|
|
343
|
-
if [[ $
|
|
389
|
+
if [[ $new_count -gt 0 ]]; then
|
|
344
390
|
echo "### New Benchmarks Added"
|
|
345
|
-
|
|
391
|
+
echo "$new_benchmarks" | grep "^." | sed 's/^/- /'
|
|
346
392
|
echo ""
|
|
347
393
|
fi
|
|
348
394
|
|
|
349
|
-
if [[ $
|
|
395
|
+
if [[ $removed_count -gt 0 ]]; then
|
|
350
396
|
echo "### Benchmarks Removed"
|
|
351
|
-
|
|
397
|
+
echo "$removed_benchmarks" | grep "^." | sed 's/^/- /'
|
|
352
398
|
echo ""
|
|
353
399
|
fi
|
|
354
400
|
}
|
|
@@ -376,14 +422,14 @@ All benchmarks run with \`-benchmem\` flag showing memory allocations and operat
|
|
|
376
422
|
EOF
|
|
377
423
|
|
|
378
424
|
# Add current results to table
|
|
379
|
-
|
|
380
|
-
data
|
|
425
|
+
while IFS= read -r benchmark; do
|
|
426
|
+
data=$(get_current_data "$benchmark")
|
|
381
427
|
ops_sec=$(echo "$data" | cut -d'|' -f1)
|
|
382
428
|
time_op=$(echo "$data" | cut -d'|' -f2)
|
|
383
429
|
mem_op=$(echo "$data" | cut -d'|' -f3)
|
|
384
430
|
allocs_op=$(echo "$data" | cut -d'|' -f4)
|
|
385
431
|
echo "| $benchmark | $ops_sec | $time_op | $mem_op | $allocs_op |" >> "$OUTPUT_FILE.tmp"
|
|
386
|
-
done
|
|
432
|
+
done < <(list_current_benchmarks)
|
|
387
433
|
|
|
388
434
|
# Add comparison section
|
|
389
435
|
generate_comparison >> "$OUTPUT_FILE.tmp"
|
|
@@ -399,14 +445,14 @@ EOF
|
|
|
399
445
|
echo "|-----------|----------------|---------|-----------|-----------|" >> "$OUTPUT_FILE.tmp"
|
|
400
446
|
|
|
401
447
|
# Add previous results
|
|
402
|
-
|
|
403
|
-
data
|
|
448
|
+
while IFS= read -r benchmark; do
|
|
449
|
+
data=$(get_previous_data "$benchmark")
|
|
404
450
|
ops_sec=$(echo "$data" | cut -d'|' -f1)
|
|
405
451
|
time_op=$(echo "$data" | cut -d'|' -f2)
|
|
406
452
|
mem_op=$(echo "$data" | cut -d'|' -f3)
|
|
407
453
|
allocs_op=$(echo "$data" | cut -d'|' -f4)
|
|
408
454
|
echo "| $benchmark | $ops_sec | $time_op | $mem_op | $allocs_op |" >> "$OUTPUT_FILE.tmp"
|
|
409
|
-
done
|
|
455
|
+
done < <(list_previous_benchmarks)
|
|
410
456
|
fi
|
|
411
457
|
|
|
412
458
|
# Move temp file to final location
|