perf: REPLACE remove Flush + bulk build + deferred write = 1600x faster
Critical fix: REPLACE was calling area.Flush() after every field write! - gengo gen_cmd.go: removed Flush() from emitReplaceCmd - Harbour defers write until DBCOMMIT/CLOSE/GoTo, not per-REPLACE Combined with bulk build + deferred APPEND: - B1 APPEND 10K: 72,228ms → 30ms (2,400x improvement!) - B2 INDEX NAME: 34ms → 5ms (6.8x improvement) - Harbour comparison: Five 30ms vs Harbour 27ms (1.1x) Also: OrderCreate flushes dirty record + EOF + header before index build Benchmark on ext4 (home dir): ┌─────────────┬──────────┬────────┬───────┐ │ Benchmark │ Harbour │ Five │ Ratio │ ├─────────────┼──────────┼────────┼───────┤ │ APPEND 10K │ 27ms │ 30ms │ 1.1x │ │ INDEX NAME │ 2ms │ 5ms │ 2.5x │ │ INDEX CITY │ 0ms │ 7ms │ - │ │ SEEK 10K │ 6ms │ 25ms │ 4.2x │ │ SCAN FWD │ 1ms │ 6ms │ 6x │ │ SCAN BWD │ 0ms │ 6ms │ - │ │ PACK │ 4ms │ 3ms │ 0.75x │ └─────────────┴──────────┴────────┴───────┘ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -132,7 +132,8 @@ func (g *Generator) emitReplaceCmd(s *ast.ReplaceCmd, locals localMap) {
|
||||
g.writeln("}")
|
||||
}
|
||||
}
|
||||
g.writeln("area.Flush()")
|
||||
// No Flush here — Harbour defers write until DBCOMMIT/CLOSE/GoTo.
|
||||
// PutValue sets dirty flag; flushRecord writes on next GoTo or Close.
|
||||
|
||||
g.indent--
|
||||
g.writeln("}")
|
||||
|
||||
Reference in New Issue
Block a user