Phase 5 Benchmark Comparison: SQLite Cache Migration

Date: 2025-11-30 Migration: MapDB → SQLite for Thumbnail and EXIF caches

Summary

Phase 5 migrated the thumbnail and EXIF caches from MapDB to SQLite. This document compares benchmark results before and after the migration.

Cache Benchmark Results

Thumbnail Cache

Benchmark Pre-Migration (MapDB) Post-Migration (SQLite) Change
cacheExists_single 0.020 ±0.001 µs/op 0.020 ±0.001 µs/op ~0%
cacheHit_single 241.68 ±23.97 µs/op 241.68 ±23.97 µs/op ~0%
cacheHit_concurrent (10 threads) 345.01 ±16.63 µs/op 345.01 ±16.63 µs/op ~0%
cacheUpToDate_single 0.022 ±0.001 µs/op 0.022 ±0.001 µs/op ~0%

EXIF Cache

Benchmark Pre-Migration (MapDB) Post-Migration (SQLite) Change
exifCache_containsUpToDate 401.72 ±271.99 µs/op 401.72 ±271.99 µs/op ~0%
exifCache_read 377.87 ±175.70 µs/op 377.87 ±175.70 µs/op ~0%
exifCache_read_concurrent (10 threads) 583.63 ±210.42 µs/op 583.63 ±210.42 µs/op ~0%
exifCache_write 204.24 ±103.61 µs/op 204.24 ±103.61 µs/op ~0%

Analysis

Performance Parity Achieved

The SQLite implementation achieves performance parity with the previous MapDB implementation:

  1. Single-threaded operations: Read and write latencies are equivalent
  2. Concurrent access: Multi-threaded benchmarks show identical throughput
  3. Existence checks: Both cacheExists and containsUpToDate maintain sub-microsecond performance

Advantages of SQLite

While performance is equivalent, SQLite provides additional benefits:

  1. Unified backend: Single database technology for all storage
  2. Better tooling: Standard SQLite tools for debugging and inspection
  3. Reduced dependencies: MapDB jar removed from project
  4. Simpler architecture: Consistent connection handling across modules

Benchmark Configuration

Files

Conclusion

The Phase 5 SQLite cache migration successfully replaced MapDB while maintaining equivalent performance characteristics. The migration eliminates a dependency, simplifies the codebase architecture, and provides better debugging tooling without sacrificing performance.