Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tapdb: add syncer cache memory usage test
This commit adds a test that calculates the approximate memory consumption of a full syncer cache. The results look pretty good: === RUN TestSyncerCacheMemoryUsage multiverse_cache_test.go:214: Generated 500 roots in 26.583318ms === RUN TestSyncerCacheMemoryUsage/500_roots multiverse_cache_test.go:224: Memory usage for 500 roots: 139496 bytes multiverse_cache_test.go:226: Memory usage per root: 278 bytes multiverse_cache_test.go:228: Benchmark took 8.836µs --- PASS: TestSyncerCacheMemoryUsage/500_roots (0.01s) multiverse_cache_test.go:214: Generated 5000 roots in 257.823179ms === RUN TestSyncerCacheMemoryUsage/5000_roots multiverse_cache_test.go:224: Memory usage for 5000 roots: 1073384 bytes multiverse_cache_test.go:226: Memory usage per root: 214 bytes multiverse_cache_test.go:228: Benchmark took 104.568µs --- PASS: TestSyncerCacheMemoryUsage/5000_roots (0.01s) multiverse_cache_test.go:214: Generated 170000 roots in 8.847171795s === RUN TestSyncerCacheMemoryUsage/170000_roots multiverse_cache_test.go:224: Memory usage for 170000 roots: 34259176 bytes multiverse_cache_test.go:226: Memory usage per root: 201 bytes multiverse_cache_test.go:228: Benchmark took 1.820929ms --- PASS: TestSyncerCacheMemoryUsage/170000_roots (0.08s) --- PASS: TestSyncerCacheMemoryUsage (9.23s)
- Loading branch information