mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
perf(accesslog): use buffer pool in BackScanner to reduce allocations
Replace per-scan byte slice allocations with a sized buffer pool, significantly reducing memory pressure during log file scanning. - Add Release() method to return buffers to pool (callers must invoke) - Remove Reset() method - create new scanner instead for simpler lifecycle - Refactor chunk prepending to reuse pooled buffers instead of append Benchmark results show allocations dropped from ~26k to 1 per scan for small chunk sizes, with better throughput. BREAKING CHANGE: Reset() removed; callers must call Release() and create a new BackScanner instance instead.
This commit is contained in:
@@ -20,7 +20,7 @@ var (
|
||||
)
|
||||
|
||||
// see back_scanner_test.go#L210 for benchmarks
|
||||
var defaultChunkSize = 256 * kilobyte
|
||||
var defaultChunkSize = 32 * kilobyte
|
||||
|
||||
// Syntax:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user