The Flyweight Pattern in Go

Definition: In computer programming, flyweight is a software design pattern. A flyweight is an object that minimizes memory usage by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. In the following, I’ll demonstrate the Flyweight Pattern with two examples in Go. First, I’ll optimize two memory-based caches that rely on the same underlying data, and then I’ll optimize another cache that contains repetitive data. [Read More]

Reading Humongous Files in Go

A real-world performance comparison between Node.js and Go for file parsing unsurprisingly turns out in Go’s favor — but how much? This blog post was first published on Medium, available via CloudBoost. Part One Being fairly new to Go aka. Golang, I was itching to try it out on a real-world problem after having done numerous tutorials and CodeWars katas (don’t know CodeWars? Try it out, it’s really cool). At my workplace, my boss just so happened to find himself in a situation where he needed to parse a humongous XML file — a perfect opportunity to show off my new Golang skills! [Read More]