Skip to content

Conversation

@dylon
Copy link
Collaborator

@dylon dylon commented Dec 27, 2025

Summary

Add memoization and binding models:

  • MemoHandle for user-controlled function memoization
  • Binding models for variable capture
  • Memoization cache infrastructure

Part of Stacked PR Series

This is PR #7 in a 28-PR stacked series implementing the bytecode VM and JIT compiler.
Base: pr06/metta-value-helpers
Next: pr08/bytecode-caches-registries


This PR series implements tiered compilation: tree-walker → bytecode VM → JIT native code

@dylon dylon force-pushed the pr06/metta-value-helpers branch from b5f1b5a to 8bd6cb1 Compare December 27, 2025 03:55
@dylon dylon force-pushed the pr07/models-memo-bindings branch from bf1fd34 to 86f5681 Compare December 27, 2025 03:56
@dylon dylon force-pushed the pr06/metta-value-helpers branch from 8bd6cb1 to 0ca8b05 Compare December 27, 2025 04:49
dylon and others added 2 commits December 27, 2025 01:08
Add MemoHandle, a memoization table for explicit caching of expensive
MeTTa computations. Features:

- O(1) lookup for previously evaluated expressions using hash keys
- Optional LRU eviction with configurable max size
- Thread-safe via RwLock for concurrent access
- Hit/miss statistics tracking for performance analysis
- Clear and stats retrieval methods

MemoHandle will be used by the `memo` special form to cache evaluation
results, providing significant speedups for repeated computations.

Includes tests for basic operations, LRU eviction, and hit rate tracking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dylon dylon force-pushed the pr07/models-memo-bindings branch from 86f5681 to 5db5447 Compare December 27, 2025 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants