Phase 6 implemented virtual threads for parallel thumbnail loading in JPhotoTagger. The benchmarks demonstrate significant improvements in folder loading performance through parallel I/O operations.
The key optimization in Phase 6 was introducing Java 21 virtual threads for parallel thumbnail fetching. This is a new benchmark that measures folder loading with concurrent thumbnail operations.
| Files | Cold Cache (Sequential) | Virtual Threads (Parallel) | Speedup |
|---|---|---|---|
| 10 | 1633.92 ms | 243.71 ms | 6.7x faster |
| 50 | 8003.89 ms | 931.42 ms | 8.6x faster |
| 100 | 16818.98 ms | 1827.47 ms | 9.2x faster |
The virtual threads implementation shows excellent scalability - the speedup increases with file count because more I/O operations can be parallelized.
| Files | Pre-Phase 6 | Post-Phase 6 | Change |
|---|---|---|---|
| 10 | 1674.22 ms | 1633.92 ms | -2.4% (faster) |
| 50 | 8337.94 ms | 8003.89 ms | -4.0% (faster) |
| 100 | 16694.34 ms | 16818.98 ms | +0.7% (within variance) |
The cold cache performance remains similar, which is expected since this benchmark measures sequential loading without the new virtual thread optimization.
| Files | Pre-Phase 6 | Post-Phase 6 | Change |
|---|---|---|---|
| 10 | 7.59 ms | 7.66 ms | +0.9% (within variance) |
| 50 | 37.67 ms | 40.11 ms | +6.5% (within variance) |
| 100 | 74.95 ms | 72.88 ms | -2.8% (faster) |
Warm cache performance is stable, as expected since thumbnails are already cached.
| Phase | Pre-Phase 6 | Post-Phase 6 | Change |
|---|---|---|---|
| Class Loading | 15.21 ms | 15.02 ms | -1.3% |
| JAXB Init | 290.79 ms | 312.64 ms | +7.5% |
| ImageIO Init | 29.09 ms | 27.96 ms | -3.9% |
| Total | 335.10 ms | 355.62 ms | +6.1% |
Startup time shows slight variance between runs. CDS (Class Data Sharing) was configured but requires the CDS archive to be generated and used at runtime for actual improvements.
| Benchmark | Pre-Phase 6 | Post-Phase 6 | Change |
|---|---|---|---|
| insertKeyword | 7.91 us/op | 8.08 us/op | +2.2% |
| keywordExists | 68.51 us/op | 72.19 us/op | +5.4% |
| selectAllKeywords | 92.77 us/op | 92.67 us/op | -0.1% |
| selectChildKeywords | 62.73 us/op | 63.83 us/op | +1.8% |
| selectRootKeywords | 49.29 us/op | 50.47 us/op | +2.4% |
Database benchmarks show stable performance within normal variance.
| Benchmark | Pre-Phase 6 | Post-Phase 6 | Change |
|---|---|---|---|
| cacheExists_single | 274.64 us/op | 266.23 us/op | -3.1% (faster) |
| cacheHit_concurrent | 1831.83 us/op | 1832.14 us/op | 0% |
| cacheHit_single | 519.03 us/op | 519.92 us/op | +0.2% |
| cacheUpToDate_single | 279.02 us/op | 282.40 us/op | +1.2% |
Cache performance remains stable.
Phase 6 successfully achieved its primary goal of significantly improving folder loading performance through virtual threads: