Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stoolap/stoolap
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.2
Choose a base ref
...
head repository: stoolap/stoolap
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.2.3
Choose a head ref
  • 5 commits
  • 76 files changed
  • 1 contributor

Commits on Jan 13, 2026

  1. feat: add background cleanup and memory management improvements

    - Add background cleanup thread for periodic garbage collection
      - Configurable via CleanupConfig (interval, retention periods)
      - Cleans deleted rows, old transactions, and previous versions
      - Auto-starts on Database::open(), stops on close()
    
    - Implement arena slot reuse to prevent unbounded memory growth
      - Free list tracks cleared slots for reuse on insert
      - Batch clearing via clear_batch() for efficient cleanup
    
    - Add Index trait _into methods to avoid allocations
      - get_row_ids_equal_into, get_row_ids_in_range_into, get_row_ids_in_into
      - Callers can reuse Vec buffers across multiple calls
    
    - Convert rows to Arc storage immediately in TransactionVersionStore::put()
      - Enables efficient Arc cloning during commit
    
    - Add rollback_all_tables() to clean up txn_version_stores on rollback
      - Prevents memory leaks when transactions are rolled back
    
    - Fix Database::Drop to only remove from registry when last reference
      - Uses Arc::ptr_eq and strong_count check to avoid breaking clones
    semihalev committed Jan 13, 2026
    Configuration menu
    Copy the full SHA
    ce9cd82 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2026

  1. perf: O(1) COUNT(*) and COUNT(DISTINCT) fast paths with memory optimi…

    …zations
    
    - Add committed_row_count atomic counter to VersionStore for O(1) COUNT(*)
      - Updated add_version, add_version_single, add_versions_batch to track counter
      - +1 for INSERT, -1 for DELETE, handles state transitions correctly
    
    - Add get_distinct_count_excluding_null() to Index trait for O(1) COUNT(DISTINCT)
      - Implemented in BTreeIndex and HashIndex
      - Avoids cloning all values just to count them
    
    - Add compiled query cache for COUNT(*) and COUNT(DISTINCT) queries
      - CompiledCountStar and CompiledCountDistinct in query_cache.rs
      - Schema epoch validation for cache invalidation
      - Properly handles FILTER clause (bypasses fast path)
    
    - Introduce RowIdVec pooled vector for index lookups
      - Thread-local buffer pooling with best-fit allocation
      - 256K max cached capacity to prevent unbounded memory
      - Fixed broken IntoIter Drop that couldn't recover buffer
    
    - BTree index optimization: use Borrow trait for lookups
      - No allocation needed for equality checks
      - Only create CompactArc for range operations
    
    - Clean up dead code in try_index_lookup OR expression handling
    
    Performance: COUNT(*) ~22.5µs → ~2.9µs (7.7x faster)
    semihalev committed Jan 14, 2026
    Configuration menu
    Copy the full SHA
    9124c7b View commit details
    Browse the repository at this point in the history
  2. perf: add cleanup for global pools and LRU caches

    - Add clear_version_map_pools() for TransactionVersions pools
    - Add clear_program_cache() for expression bytecode LRU cache
    - Add clear_classification_cache() for query classification LRU cache
    - Call all cleanup functions from clear_all_thread_local_caches()
    
    Memory at program end: 665 KB → 153.6 KB (77% reduction)
    semihalev committed Jan 14, 2026
    Configuration menu
    Copy the full SHA
    8701d9e View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2026

  1. perf: introduce SmartString, I64Map, and value interning for memory e…

    …fficiency (#10)
    
    Major optimizations:
    
    **SmartString** - Custom SSO string replacing CompactString
    - Inline storage for strings ≤22 bytes (no heap allocation)
    - Owned (Box<str>) for computed values, Shared (Arc<str>) for cloned values
    - 24-byte size with O(1) clone for shared variant
    
    **I64Map** - High-performance hashmap for i64 keys
    - Uses i64::MIN as empty sentinel (row/txn IDs are always ≥0)
    - FxHash-based with linear probing and backward-shift deletion
    - ~45% faster lookups than FxHashMap<i64, V>
    
    **Value Interning** - Shared instances for common values
    - Interned: NULL (all 7 DataTypes), booleans, integers 0-1000
    - Reduces allocations for frequently used values in rows
    
    **Aggregation Fixes & Optimizations**
    - Fixed hash collision bug in single-column GROUP BY (was using hash as key)
    - Added 2-column tuple optimization (30% faster than Vec<Value>)
    - Single-column primitive GROUP BY uses I64Map directly
    
    **SIMD Pattern Matching**
    - memchr::memmem for LIKE '%pattern%' substring search
    - Pre-compiled Finder stored in CompiledPattern
    
    **Other Improvements**
    - CompactVec: new insert(), retain(), drain() methods
    - All indexes migrated to I64Map and CompactVec
    - Thorough SAFETY documentation on unsafe code
    semihalev authored Jan 17, 2026
    Configuration menu
    Copy the full SHA
    221606b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b2a0d0 View commit details
    Browse the repository at this point in the history
Loading