Use FrozenDictionary and FrozenSet for immutable, highly-optimized read-only collections.
Tag: AI
Tips and Tricks #195: Use ValueTask for Hot Async Paths
Replace Task with ValueTask in frequently-called async methods that often complete synchronously.
Tips and Tricks #194: Leverage ArrayPool for Temporary Buffer Reuse
Rent and return arrays from a shared pool to avoid repeated allocations in buffer-heavy code.
Tips and Tricks #192: Implement Retry Logic for LLM API Calls
Handle rate limits and transient failures gracefully with exponential backoff.
Tips and Tricks #191: Cache LLM Responses for Cost Reduction
Implement semantic caching to avoid redundant LLM calls and reduce API costs.
Tips and Tricks #190: Implement Prompt Templates for Consistent LLM Output
Use structured prompt templates to get reliable, formatted responses from LLMs.