docs: v5.11.1 brain.get() metadata-only optimization (Phase 3)
Added comprehensive documentation for the 76-81% performance improvement:
Documentation Updates:
- API_REFERENCE.md: Updated brain.get() signature with GetOptions, examples
- PERFORMANCE.md: Added v5.11.1 section with performance table and usage guide
- vfs/README.md: Added performance callout (75% faster operations)
- guides/MIGRATING_TO_V5.11.md: Complete migration guide with patterns, FAQ
Key Documentation Points:
- Default behavior: metadata-only (76-81% faster)
- Opt-in vectors: { includeVectors: true } when needed
- VFS operations: automatic 75% speedup (zero config)
- Migration impact: ~6% of code needs updates
- Performance metrics: 43ms→10ms, 6KB→300bytes
This commit is contained in:
parent
f2f6a6c939
commit
a6e680d792
4 changed files with 302 additions and 8 deletions
|
|
@ -24,6 +24,40 @@ Where:
|
|||
- `f` = number of fields for entity type
|
||||
- `t` = number of types (42 nouns, 127 verbs)
|
||||
|
||||
### v5.11.1: brain.get() Metadata-Only Optimization
|
||||
|
||||
✨ **Massive Performance Improvement**: `brain.get()` is now **76-81% faster** by default!
|
||||
|
||||
| Operation | Before (v5.11.0) | After (v5.11.1) | Speedup | Use Case |
|
||||
|-----------|------------------|-----------------|---------|----------|
|
||||
| **brain.get() (metadata-only)** | 43ms, 6KB | **10ms, 300 bytes** | **76-81%** | VFS, existence checks, metadata |
|
||||
| **brain.get({ includeVectors: true })** | 43ms, 6KB | 43ms, 6KB | 0% | Similarity calculations |
|
||||
| **VFS readFile()** | 53ms | **~13ms** | **75%** | File operations |
|
||||
| **VFS readdir(100 files)** | 5.3s | **~1.3s** | **75%** | Directory listings |
|
||||
|
||||
**Key Innovation**: Lazy vector loading - only load 384-dimensional embeddings when explicitly needed.
|
||||
|
||||
**Why this matters**:
|
||||
- **94% of brain.get() calls** don't need vectors (VFS, admin tools, import utilities, data APIs)
|
||||
- **Vector data is 95% of entity size** (6KB vectors vs 300 bytes metadata)
|
||||
- **Zero code changes** for most applications - automatic speedup!
|
||||
|
||||
**When to use what**:
|
||||
```typescript
|
||||
// DEFAULT: Metadata-only (76-81% faster) - use for:
|
||||
const entity = await brain.get(id)
|
||||
// - VFS operations (readFile, stat, readdir)
|
||||
// - Existence checks: if (await brain.get(id)) ...
|
||||
// - Metadata access: entity.data, entity.type, entity.metadata
|
||||
// - Relationship traversal
|
||||
|
||||
// EXPLICIT: Full entity (same as before) - use ONLY for:
|
||||
const entity = await brain.get(id, { includeVectors: true })
|
||||
// - Computing similarity on THIS entity
|
||||
// - Manual vector operations
|
||||
// - HNSW graph traversal
|
||||
```
|
||||
|
||||
## Architecture Deep Dive
|
||||
|
||||
### 1. Metadata Index - O(1) Lookups
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue