Liking cljdoc? Tell your friends :D

Performance Optimization Documentation

This directory contains comprehensive documentation of the performance optimization work that achieved 40-60% performance improvements across all workloads through systematic profiling-guided optimization.

Quick Start

Start here: OPTIMIZATION_SUMMARY.md

This document contains the complete optimization journey, key results, and lessons learned.

Documentation Structure

Main Documents

  • OPTIMIZATION_SUMMARY.md - START HERE
    • Complete optimization journey (Phases 1-6)
    • Final performance results
    • Technical details and lessons learned
    • 40-60% faster across all workloads

Phase-Specific Documentation

Phase 4: SmallVec Investigation (Not Adopted)

  • PHASE4_SMALLVEC_INVESTIGATION.md
    • Why SmallVec<[Position; N]> was investigated
    • Benchmark results for different sizes (4, 8, 12)
    • Why it was rejected (workload variability)

Phase 5: StatePool Allocation Reuse (MAJOR SUCCESS)

Phase 6: Arc Path Sharing (HIGHLY SUCCESSFUL)

Supporting Documentation

Benchmark Results

  • benchmarks/ directory
    • benchmark_results_phase5.txt - Phase 5 benchmark output
    • benchmark_results_phase6.txt - Phase 6 benchmark output

Profiling Data

  • profiling/ directory
    • profiling_phase5.txt - Phase 5 profiling output
    • profiling_phase6.txt - Phase 6 profiling output

Key Results Summary

Cumulative Improvements (Baseline → Phase 6)

WorkloadImprovement
Distance 2 queries-48%
Distance 3 queries-42%
Long queries (13 chars)-45%
Medium/large dictionaries-40% to -43%
Standard algorithm-32%
Small dictionaries-52% (net)

Profiling Evidence

  • Phase 3: Dictionary edges reduced from 27% to ~13%
  • Phase 5: State::clone eliminated (21.73% → 0%)
  • Phase 6: Intersection::clone reduced by 72% (21.23% → 5.90%)

Total: ~50% of original runtime overhead eliminated!

Optimization Phases

  1. Phase 1: Transducer layer optimizations (2-18% improvements)
  2. Phase 2: Profiling discovery (identified dictionary bottleneck at 27%)
  3. Phase 3: Lazy edge iterator (15-50% improvements)
  4. Phase 4: SmallVec investigation (not adopted - workload variability)
  5. Phase 5: StatePool allocation reuse (9-34% improvements, State::clone eliminated)
  6. Phase 6: Arc path sharing (7-19% improvements, 72% Intersection::clone reduction)

Key Takeaways

  • Profile before optimizing - Assumptions about bottlenecks were wrong
  • Benchmark every change - Only way to discover trade-offs
  • Follow the data - Each profiling round revealed the next optimization target
  • Persistence pays off - Multiple approaches led to exceptional results
  • Accept trade-offs - Arc path regression on small dicts (+5.5%) is worth massive gains elsewhere (7-19%)

For More Information

See OPTIMIZATION_SUMMARY.md for the complete story and technical details.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close