Skip to content

v2.0.0

Latest

Choose a tag to compare

@cmarschner cmarschner released this 16 Jan 19:28

⏺ Summary of Changes: v1.0.0 → v2.0.0

Breaking Changes 🔴

Pythonic Class Names

  • PersistentMap → PersistentDict
  • PersistentVector → PersistentList
  • PersistentHashSet → PersistentSet
  • PersistentTreeMap → PersistentSortedDict

Dual API Introduction

Both functional (Clojure-style) and Pythonic methods now available:

  • Pythonic: .set(), .delete()
  • Functional: .assoc(), .dissoc()

New Data Structures 🎉

v1.0.0 only had PersistentMap. v2.0.0 adds:

  • ✨ PersistentList - Indexed sequence (bit-partitioned trie)
  • ✨ PersistentSet - Unique elements collection (HAMT-based)
  • ✨ PersistentSortedDict - Sorted map with range queries (Red-Black Tree)
  • ✨ PersistentArrayMap - Optimized for small maps (<8 entries)

Total: 1 → 5 data structures

New Features ✨

  1. Native Pickle Support
    - All data structures fully serializable
    - pickle.dumps() / pickle.loads() work out of the box
  2. Slice Notation for Range Queries
    - PersistentSortedDict: scores[20:50] as alias for subseq(20, 50)
    - More Pythonic range query syntax
  3. Comprehensive Documentation
    - Interactive Jupyter notebook with 8 sections
    - Google Colab ready
    - Performance comparisons
    - Real-world use cases
  4. Operator Overloads
    - Merge operator | for all dict types
    - Set operators &, -, ^ for PersistentSet

Bug Fixes 🐛

  1. Fixed PersistentSortedDict reference counting
    - Resolved segfaults during garbage collection
    - Fixed iterator dangling pointer bug
    - All 50 tests now passing (was 17/50)
  2. Fixed merge operations
    - No more crashes on large merges
    - Correct count tracking
  3. Windows Build Support
    - Replaced ssize_t with Py_ssize_t
  4. Iterator Safety
    - Fixed dangling pointer causing segfault

Code Quality Improvements 🔧

  1. Zero Compiler Warnings
    - Fixed deprecated get_type() → py::type::of()
    - Marked unused parameters
    - Removed dead code
  2. Better Test Coverage
    - Comprehensive tests for all data structures
    - Pickle tests (17 new tests)
    - Edge case coverage
  3. Organized Project Structure
    - Tests moved to tests/ directory
    - Python scripts to scripts/ directory
    - C++ files renamed to match Python classes

Performance 🚀

(Same as v1.0.0, but now across more data structures)

  • 3-5x faster than pyrsistent
  • 24-3271x faster for structural sharing
  • Merge operations up to 176x faster

Documentation 📚

  1. Updated README
    - Corrected examples for all APIs
    - Added pickle documentation
    - Clear breaking changes section
    - Performance benchmarks
  2. New Jupyter Notebook
    - 32 interactive cells
    - Covers all 4 main data structures
    - Performance demos
    - Real-world examples (undo/redo, thread safety)

Commits Summary

  • 42 commits between v1.0.0 and v2.0.0
  • 4 new data structures implemented
  • Multiple critical bugs fixed
  • Complete API overhaul for Pythonic conventions