#performance

17 snippets tagged with #performance

typescriptadvanced

Redis Cache Get/Set Helper

Type-safe Redis cache wrapper with automatic JSON serialization, TTL support, and cache-aside pattern.

#redis#cache
typescriptbeginner

useDebounce — Debounced Value Hook

Debounce any rapidly-changing value with a configurable delay. Useful for search inputs and resize handlers.

#hooks#debounce
typescriptintermediate

Infinite Scroll with Intersection Observer

Load more items as the user scrolls using IntersectionObserver. No external libraries required.

#infinite-scroll#intersection-observer
typescriptadvanced

Virtualized List Component

Render large lists efficiently by only rendering visible items with calculated scroll positioning.

#virtualization#performance
typescriptbeginner

Image Lazy Load Component

Lazy load images with a blur-up placeholder effect using Intersection Observer and CSS transitions.

#images#lazy-loading
typescriptbeginner

Next.js Image Optimization Patterns

Use next/image with responsive sizes, blur placeholders, and priority loading for optimal Core Web Vitals.

#images#optimization
typescriptadvanced

Partial Prerendering with Suspense

Combine static shells with streamed dynamic content using React Suspense for instant page loads.

#ppr#suspense
sqlintermediate

Keyset Pagination vs Offset

Efficient keyset (cursor) pagination pattern compared to traditional OFFSET for large datasets in PostgreSQL.

#pagination#performance
sqladvanced

Materialized View with Auto-Refresh

Create and maintain materialized views for expensive aggregate queries with concurrent refresh support.

#materialized-view#performance
sqladvanced

LATERAL Join for Top-N Per Group

Use LATERAL joins to efficiently fetch the top N related rows per group without window function subqueries.

#lateral-join#top-n
sqladvanced

Table Partitioning by Range

Partition large tables by date range for faster queries and easier data lifecycle management.

#partitioning#performance
sqlbeginner

EXISTS vs IN Subquery Patterns

Choose between EXISTS and IN subqueries for optimal performance based on data distribution.

#subquery#exists
sqlintermediate

Covering Index (INCLUDE Columns)

Create covering indexes with INCLUDE columns to satisfy queries entirely from the index.

#indexing#performance
pythonintermediate

Generator Pipeline for Data Processing

Chain generators to build memory-efficient data processing pipelines for large files and streams.

#generator#pipeline
pythonintermediate

LRU Cache with TTL Support

Extend functools.lru_cache with time-based expiration for caching expensive function calls with staleness control.

#cache#lru
pythonbeginner

functools.cache and lru_cache

Memoize expensive function calls with functools.cache and lru_cache for automatic result caching.

#caching#functools
bashbeginner

Git Shallow Clone for Large Repos

Shallow clone techniques to reduce download size by limiting commit history depth.

#git#shallow-clone