Cache expensive function results automatically with the built-in cache decorator.
Tag: csharp
Tips and Tricks – Use Generators for Memory-Efficient Data Processing
Process large datasets without loading everything into memory using Python generators.
Tips and Tricks – Use ValueTask for Hot Async Paths
Replace Task with ValueTask in frequently-called async methods that often complete synchronously.
Tips and Tricks – Use Span for Zero-Allocation String Parsing
Eliminate heap allocations when parsing strings by using Span
Tips and Tricks – Implement Retry Logic for LLM API Calls
Handle rate limits and transient failures gracefully with exponential backoff.
Tips and Tricks – Freeze Collections for Thread-Safe Read Access
Use FrozenDictionary and FrozenSet for immutable, highly-optimized read-only collections.
Tips and Tricks – Leverage ArrayPool for Temporary Buffer Reuse
Rent and return arrays from a shared pool to avoid repeated allocations in buffer-heavy code.