Files
cproof/tests/bench/baseline.csv
jabber.developer2 555faaa232
Some checks failed
CI Code / Check spelling (pull_request) Failing after 21s
CI Code / Linux (arch) (pull_request) Failing after 3m6s
CI Code / Check coding style (pull_request) Failing after 3m10s
CI Code / Code Coverage (pull_request) Successful in 2m49s
CI Code / Linux (debian) (pull_request) Successful in 4m26s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m38s
perf+harden(export): 25x faster export at 1M, mkstemp, full-body dedup
Address 6 of 7 high/medium audit findings on database_export.c.
End-to-end migration of 1M rows: ~5 min -> ~1 min.

  H1  cache g_slist_length(merged) out of the write loop — was O(n²)
      via 2000 list walks at 500-row progress interval, now O(1).
        S7a_export_cold @ 1M:  309 s -> 11.2 s  (-96 %)

  L1  splice existing flatfile lines into merged via ownership
      transfer instead of 12-strdup deep-copy + g_date_time_ref;
      free list nodes only, NULL out existing.
        S7b_export_dedup @ 1M: 304 s -> 13.3 s  (-96 %)
        RSS @ S7b 1M: 2.4 GB -> 1.9 GB

  H2  mkstemp() with random suffix instead of fixed
      "{log_path}.export.tmp". Eliminates the unlink-and-retry race
      where two concurrent exports could clobber each other's
      in-flight tmp files.

  M4  SHA-256 over full body (incremental g_checksum_update) in
      the dedup-key fallback. Previous body[:256] hash collided
      on common preambles (signatures, code blocks) — second
      occurrence silently dropped on import.

  M2  Refuse _ff_read_all_lines on files > 2 GB. Each line expands
      ~10x in heap on parse; without a cap we OOM-kill prof on
      large flatfiles. Surface a clear error instead.

  M5  Break the outer import loop on system-level INSERT failure.
      Was cascading "Import of X failed" through every remaining
      contact when the real issue was disk-full / sqlite locked.

Verified on bench-pipeline-max: 1M rows, full content diff,
mismatches=0. baseline.csv updated.

Deferred: M3 O_TMPFILE (platform-conditional + linkat dance;
mkstemp covers most of the same window) and M6 SIGINT cancellation
(needs event-loop architecture changes).
2026-04-30 17:10:39 +03:00

5.1 KiB

1scenariovolumebyteslineswall_mspeak_rss_kbnote
2S1_cold_tailsmall394947161000246.04014408tail page=100
3S2_warm_tailsmall394947161000233.87814716tail page=100
4S3_deep_paginationsmall39494716100021.02414716n_pages=1000
5S4_first_buildsmall394947161000239.13914716idx_entries=20
6S5_incremental_extendsmall10441110000.85914716appended=1000_lines
7S6_verifysmall3949471610002396.02216424total=1 err=0 warn=1 info=0
8L1longmsg1105861001.4869432n=100 body=1024 write=0.8ms read=0.6ms parsed=100 mismatch=0 parse_fail=0 1KB body x100
9L2longmsg103218610010.4689432n=100 body=10240 write=5.7ms read=4.8ms parsed=100 mismatch=0 parse_fail=0 10KB body x100
10L3longmsg10248186100100.3379816n=100 body=102400 write=57.3ms read=43.1ms parsed=100 mismatch=0 parse_fail=0 100KB body x100
11L4longmsg5243293650502.78513608n=50 body=1048576 write=264.5ms read=238.3ms parsed=50 mismatch=0 parse_fail=0 1MB body x50
12L5longmsg5242969610518.55827764n=10 body=5242880 write=264.4ms read=254.2ms parsed=10 mismatch=0 parse_fail=0 5MB body x10
13L6longmsg414355524407.80345852n=4 body=10358784 write=211.3ms read=196.5ms parsed=4 mismatch=0 parse_fail=0 9.9MB body x4 (just under FF_MAX_LINE_LEN)
14L7longmsg1048598123.75045852oversize=10485761_rejected=yes read=3.8ms parsed=1
15L8longmsg51752865045.54945852n=50 body=102400 write=26.6ms read=18.9ms parsed=50 mismatch=0 parse_fail=0 100KB body w/ \n every 100B
16L9longmsg51241365045.48745852n=50 body=102400 write=24.5ms read=21.0ms parsed=50 mismatch=0 parse_fail=0 100KB body w/ pipes
17L10longmsg51241365043.25445852n=50 body=102400 write=18.9ms read=24.4ms parsed=50 mismatch=0 parse_fail=0 100KB body utf-8 emoji
18L11longmsg1105861001.28445852n=100 body=1024 write=0.7ms read=0.6ms parsed=100 mismatch=0 parse_fail=0 sanity baseline
19L12longmsg5415366100026.437458525x1MB_in_last_100 parsed=1000
20L13longmsg104865786100932.63045852n=100 body=1048576 write=485.7ms read=446.9ms parsed=100 mismatch=0 parse_fail=0 verify-equiv full parse on 100x1MB
21L14longmsg1024819861000962.34245852n=1000 body=102400 write=510.4ms read=452.0ms parsed=1000 mismatch=0 parse_fail=0 rapid append 1000x100KB
22F1fail-pass90400.1189540issues total=1 err=0 warn=1 (partial-line tail; expect graceful handle)
23F2fail-pass111900.1139540warnings=2 (expect CRLF warning) first_warn=File permissions are 644 expected 600 (sensitive data)
24F3fail-pass34100.0729540errors=1 warnings=1 (expect 1 unparsable line for mid-file BOM) first=Unparsable line
25F7fail-pass52700.0829540issues total=1 err=0 (cycle handled at read-time not verify)
26F8fail-pass1904400.9819540201 lines (1 orig + 200 corrections) errors=0 warns=1
27F9fail-pass34100.0699540errors=0 (parser splits at first ': ' — not flagged but body truncated)
28F10fail-pass17600.0609540errors=0 warnings=1 (RTL/ZWSP preserved literally)
29F11fail-pass32300.2649540errors=1 (Latin-1 byte: error or fallback OK)
30F12fail-pass33000.0719540errors=0 (empty body OK)
31F14fail-pass2323600.9149540v1_lines=100 v2_lines=250 (expect rebuild detected and 250 lines)
32F15fail-pass000.1219540errors=0 infos=1 warnings=1 (empty file should yield INFO)
33S1_cold_taillmc389183687100002480.42843456tail page=100
34S2_warm_taillmc389183687100002477.48243456tail page=100
35S3_deep_paginationlmc3891836871000021.06643456n_pages=1000
36S4_first_buildlmc389183687100002473.60443456idx_entries=200
37S5_incremental_extendlmc10441110000.90243456appended=1000_lines
38S6_verifylmc3891836871000023892.13743456total=1 err=0 warn=1 info=0
39S6_verifyooo3975867201000024037.05833336total=17573 err=0 warn=17573 info=0
40S7a_export_coldpipe100000407142401000001231.613148128exported=100000 db_rows=100000
41S7b_export_deduppipe100000407142401000001484.406199460exported=0 db_rows=100000
42S7_seed_exportpipe100000407142401000001238.138148208exported=100000 db_rows=100000
43S8a_import_coldpipe100000406282241000003237.481123108imported=100000 rows_before=0 rows_after=100000
44S8b_import_idempotentpipe1000004062822401047.286194860imported=0 rows_before=100000 rows_after=100000
45S8e_roundtrippipe100000405217281000006520.475148184rows=100000 seed=1591ms export=1237ms import=3376ms diff=317ms exported=100000 imported=100000 rows_a=100000 rows_b=100000 mismatches=0 body=0 lmc=0
46S7a_export_coldpipe1000000407732224100000011247.1071376772exported=1000000 db_rows=1000000
47S7b_export_deduppipe1000000407732224100000013262.6431873220exported=0 db_rows=1000000
48S7_seed_exportpipe1000000407732224100000012125.6241377076exported=1000000 db_rows=1000000
49S8a_import_coldpipe1000000406605824100000036877.8011124804imported=1000000 rows_before=0 rows_after=1000000
50S8b_import_idempotentpipe1000000406605824011986.7861841488imported=0 rows_before=1000000 rows_after=1000000
51S8e_roundtrippipe1000000405757952100000066449.7621377084rows=1000000 seed=20012ms export=11939ms import=31533ms diff=2966ms exported=1000000 imported=1000000 rows_a=1000000 rows_b=1000000 mismatches=0 body=0 lmc=0