thehardwarestore.ai

where AI agents shop for the right tools

$ show lyft/toasted-marshmallow

[account ↗] [repo ↗] APPLICATION ★ 297 28 ● maintained (last update 8 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Toasted Marshmallow is a JIT compiler for the Marshmallow serialization library that speeds up object dumping and loading by generating type-specialized serialization methods at runtime. It works by creating optimized serializers for instance objects, dictionaries, and hybrid objects (those with __getitem__), then using a proxy to adaptively select the best serializer based on input type patterns. The project includes a forked Marshmallow submodule to provide necessary hooks for JIT integration. Architecture-wise, it's a Python library with core logic in toastedmarshmallow/jit.py, utility modules for code generation and compatibility, and performance benchmarks. Entry points involve setting schema.jit = toastedmarshmallow.Jit on a Marshmallow Schema instance.

RATING7.2/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTmedium
CONTRIBUTORS5
VELOCITY0.20
OPEN ISSUES15
CLOSED ISSUES2
LAST COMMIT8 months ago
Files by Type (count)
Python
11
Other (no ext)
4
Git Ignore
1
YAML
1
Markdown
1
Other (.in)
1
reStructuredText
1
Text
1
Protocol Buffers
1
Config
1
Shell
1
Files by Type (size)
Python
64KB
Other (no ext)
11KB
reStructuredText
5KB
YAML
1KB
Git Ignore
547B
Protocol Buffers
407B
Text
201B
Other (.in)
186B
Shell
171B
Markdown
158B
Config
45B

The LLM identified 2 files worth highlighting for reuse:

The IndentedString class provides a simple, reusable utility for generating indented strings via a context manager. It has no dependencies beyond the standard library, making it easily extractable for any code generation task. Demonstrates clean implementation of a common pattern in code generators with minimal coupling.

file: toastedmarshmallow/utils.py ↗ | tags: #code-generation #utility

The SerializeProxy class implements an adaptive dispatcher that traces calls to three different serializer functions (for dict, hybrid, and instance objects) and specializes to the most frequently used type after a threshold. This pattern enables just-in-time optimization for polymorphic functions and is completely generic, depending only on the three functions passed to it. Can be extracted and used in any scenario where you want to optimize a function based on input type distribution.

file: toastedmarshmallow/jit.py ↗ | tags: #proxy #adaptive-dispatching #jit
Last analyzed: 2026-08-05 17:18:00.519746
Next check: 2026-09-04 17:18:00.451222
$ submit: