Skip to main content

Overview

Performance optimization techniques for ZKScore SDK integration.

Optimization Strategies

1. Caching

const cache = new Map();

async function getCachedScore(identity) {
  if (cache.has(identity)) {
    return cache.get(identity);
  }
  
  const score = await client.getScore(identity);
  cache.set(identity, score);
  
  return score;
}

2. Batch Operations

Query multiple users simultaneously instead of sequentially.

3. Real-time WebSockets

Use WebSocket connections for live updates instead of polling.

4. Lazy Loading

Load data only when needed.

5. Debouncing

Debounce rapid requests to reduce API calls.