Skip to content

Initial Release of SqrtSpace SpaceTime

Choose a tag to compare

@logikonline logikonline released this 20 Jul 19:51
· 3 commits to main since this release

🎉 Initial Release of SqrtSpace SpaceTime

Memory-efficient algorithms and data structures for Python using Williams' √n space-time tradeoffs.

✨ Features

  • Memory-Efficient Collections: SpaceTimeArray and SpaceTimeDict with automatic disk spillover
  • External Algorithms: Sort and group large datasets using only √n memory
  • Stream Processing: Process files larger than RAM with elegant API
  • Auto-Checkpointing: Resume long computations from where they left off
  • Memory Profiling: Identify optimization opportunities in your code
  • ML Optimizations: Reduce neural network training memory by up to 90%

Installation

pip install sqrtspace-spacetime

Quick Start

from sqrtspace_spacetime import SpaceTimeArray, external_sort, Stream

# Memory-efficient array
array = SpaceTimeArray(threshold=10000)
for i in range(1000000):
    array.append(i)

# Sort large datasets with minimal memory
sorted_data = external_sort(huge_list)

# Stream processing
Stream.from_csv('huge_file.csv') \
    .filter(lambda row: row['value'] > 100) \
    .to_csv('processed.csv')

Documentation

- https://github.com/sqrtspace/sqrtspace-python/tree/main/examples
- https://github.com/sqrtspace/sqrtspace-python#api-reference

Acknowledgments

Based on theoretical computer science results by Williams, showing that many algorithms can achieve better memory
usage by accepting a slightly slower runtime.