Avoiding collisions in Go context keysMaster Go context keys with custom types, avoid collisions using empty structs, and learn accessor patterns for safe request-scoped values.Redowan Delowar·Oct 22·6 min readFollowGoAPIPerformance
Why does Go's io.Reader have such a weird signature?Understand why io.Reader takes a byte slice parameter instead of returning one. Learn about heap allocations and buffer reuse in Go streams.Redowan Delowar·Feb 8·3 min readFollowGoTILPerformance
Quicker startup with module-level __getattr__Speed up Python module imports with __getattr__ from PEP 562 for lazy loading, deprecation warnings, and dynamic attribute access.Redowan Delowar·Nov 3·3 min readFollowPythonTILPerformance
Dysfunctional options pattern in GoDiscover a simpler alternative to functional options: method chaining with builder-style configuration that's 76x faster and easier to understand.Redowan Delowar·Mar 6·5 min readFollowGoAPIPerformance
Memory leakage in Python descriptorsPrevent memory leaks in Python descriptors by using weakref to avoid hard references that prevent garbage collection of validated objects.Redowan Delowar·Jul 16·4 min readFollowPythonTILPerformance
Save models with update_fields for better performance in DjangoOptimize Django model saves with update_fields parameter to generate leaner SQL queries and improve performance in tight update loops.Redowan Delowar·Nov 9·2 min readFollowPythonDjangoTILPerformance
Dissecting an outage caused by eager-loading file contentLearn from a production outage caused by loading large CSV files into memory. Stream process files to prevent OOM errors and crashes.Redowan Delowar·Oct 14·5 min readFollowPythonIncident Post-mortemDjangoPerformance
Prefer urlsplit over urlparse to destructure URLsUse Python's urlsplit instead of urlparse for faster URL parsing by skipping the rarely-needed params component in URL decomposition.Redowan Delowar·Sep 10·2 min readFollowPythonPerformance
Pre-allocated lists in PythonUnderstand CPython list memory allocation: how lists store pointer references, grow dynamically, and when pre-allocation with [None]*n helps.Redowan Delowar·Mar 27·3 min readFollowPythonPerformanceData Structures
Don't wrap instance methods with 'functools.lru_cache' decorator in PythonAvoid memory leaks when caching instance methods with lru_cache by making cache containers local to instances instead of global.Redowan Delowar·Jan 15·5 min readFollowPythonTILPerformance
String interning in PythonLearn how Python's string interning optimizes memory by caching strings and using sys.intern() for custom string caching to improve performance.Redowan Delowar·Jan 5·3 min readFollowPythonPerformance