# Optimization Overview
⚡️ Tags:
📍Performance
📍Overview
# Best practices for code
- Use efficient data structures & algorithms
- Avoid unnessessary code execution
- Use caching to improve perf
- Optimize database query
- Use profiling tools to identify perf bottlenecks
# FE Performance
# Web Optimization
# Web Perf Metrics
# FE Cheatsheet
- Compression
- Selective Rendering
- Loading sequence
- Pritority-based loading
- Pre-fetching
- Code splitting
- Tree shaking
- Dynamic imports
# API Performance
# API Latency factors
# Reducing latency methods
- DB Indexing
- Create the right indexes
- Optimize & refactor slow running queries
- Caching
- Store frequently accessed data in a cache
- Minimize costly db lookups
- Load balancing
- Distribute requests evenly between servers
- Use the right LB type & the appropriate algorithm
- CDN
- Cache static content near the end-users
- Reduce geographic distance to reduce latency
- Async processing
- Dont block the request flow for running tasks
- Execute such task in the background
- Data compression
- Compress data before sending over network
- use libs like gZip or zLib