The Problem with Traditional Feature Flags
Most feature flag systems evaluate flags by making API calls to a remote server: This creates:- Latency: 50-200ms per flag check
- Dependencies: Can’t work offline
- Costs: API call for every flag evaluation
- Scale issues: More users = more API calls = higher costs
FlagKit’s Approach
FlagKit evaluates flags locally using a decision tree compiled at build time:Zero API calls during flag evaluation
< 0.1ms evaluation time
Offline capable - works without network
Unlimited scale - no per-evaluation cost
How It Works
1. Decision Tree Generation
When you runflagkit generate, FlagKit compiles your flag rules into a decision tree:
.flagkit/generated/decision-tree.json
2. Local Evaluation
At runtime, the client evaluates this tree in memory:Evaluation Algorithm
1
Load Context
Gather user context (userId, email, plan, etc.)
2
Check Rules
Evaluate targeting rules in priority order
3
Return Value
Return first matching rule’s value, or default
Example Evaluation
Performance Benchmarks
All benchmarks run on MacBook Pro M1, single-threaded
| Operation | Time | Comparison |
|---|---|---|
| FlagKit local evaluation | < 0.1ms | - |
| LaunchDarkly API call | ~100ms | 1000x slower |
| Split.io API call | ~150ms | 1500x slower |
| Reading local variable | ~0.001ms | Similar |
Scale Test
Trade-offs
Advantages ✅
- Zero latency - No network calls
- Offline capable - Works without connectivity
- Unlimited scale - No per-request costs
- Simple architecture - No backend dependency for evaluation
- Privacy-friendly - No user data leaves the client
Limitations ⚠️
- Rule changes require deploy - Can’t toggle instantly from dashboard
- Bundle size - Decision tree included in app bundle (~5-50KB)
- Client-side visibility - Users can inspect decision tree
When to Use Local vs. Remote Evaluation
- Use Local (FlagKit)
- Use Remote
High-traffic applications - Reduce API costs
Performance-critical paths - Zero latency matters
Offline-capable apps - Mobile, PWAs, edge functions
Privacy-sensitive - Keep user data local
Predictable rollouts - Changes via deploys are acceptable
Hybrid Approach
FlagKit supports a hybrid model for emergency situations:Next Steps
Deterministic Rollouts
Learn how FlagKit implements percentage-based rollouts

