Part 2 - From $O(N^2)$ to $O(N)$ with Zero Memory Churn: A Go Optimization Story

In my previous post, I optimized a slice difference algorithm ($O(n+m)$) by pre-allocating memory. But as a Software Architect, I immediately asked myself: Can I do this with zero extra memory for the result? The answer is an in-place algorithm, implemented using the two-pointer technique. In high-performance systems and big data pipelines, this approach is often the gold standard because it minimizes memory churn and reduces pressure on the garbage collector. ...

April 26, 2026 · 3 min · 508 words · Rajesh Subramanian

Part 2 - From $O(N^2)$ to $O(N)$ with Zero Memory Churn: A Go Optimization Story

🚀 From O(N2) to O(N) with Zero Memory Churn: A Go Optimization Story As a Software Architect, I believe the difference between “code that works” and “production-grade engineering” lies in understanding the runtime. Today, I’m sharing a journey of optimizing a simple Array Difference algorithm in Go (Golang), achieving a 66% reduction in RAM and a 73% drop in allocations. 🛠️ The Evolution of the Solution Step 1: The Functional Baseline (The “Naive” Approach) ...

April 19, 2026 · 2 min · 337 words · Rajesh Subramanian
Go Composition vs Inheritance

Is it Inheritance? No, it’s Composition (The Go Way)

Why moving from Java/Spring to Go feels like trading a complex hierarchy for a modular Lego set.

March 1, 2026 · 3 min · 592 words · Rajesh Subramanian