Appearance
Persistence
Timeline: Feb 5, 2026 | Status: done
Save/load scene state.
Goals
- JSON Serialize
- SO state (bounds)
- SO orientation (moved from O_Scene to Smart_Object as SOT)
- camera position (eye, center, up)
- Save to localStorage (single scene, auto-save on drag)
- Load latest one on app start
- Clear/reset option (reset button in Controls, white bg, black hover)
Format Research
| Format | Speed | Size | Human Readable | Notes |
|---|---|---|---|---|
| JSON | Baseline | Largest | Yes | Universal, easy debugging |
| MessagePack | ~37% faster | ~15% smaller | No | Best performance overall |
| CBOR | ~27% faster | ~27% smaller | No | AWS-friendly, JSON-like schema |
| BSON | Slower encode, faster decode | Larger than MP | No | MongoDB native |
Key findings:
- MessagePack wins on raw performance — 10K objects serialize in ~918μs
- CBOR is the best drop-in JSON replacement (same data model, binary encoding)
- JSON still solid for debugging and human editing
Decision: Use JSON — readable, debuggable, localStorage-friendly. If performance becomes an issue, use MessagePack or CBOR (same structure, just binary).
Sources:
- SitePoint: Data Serialization Comparison
- DEV: JSON Alternatives
- Zderadicka: JSON vs CBOR vs MessagePack
Implementation
Smart_Object.serialize()/Smart_Object.deserialize()— name + 6 bounds + orientation quatCamera.serialize()/Camera.deserialize()— eye, center, up vectorsScenesmanager — save/load/clear via Preferences localStorage wrapperSetup.ts— loads saved state on init, saves after every drag