Double Your Linear Search Speed with This One Weird Trick

Recently at work I optimized key-lookup for Ristretto, a caching library for Go, effectively doubling the lookup speed with one trick. This post walks you through what I did. The benchmarks and code can be found here. Overview Ristretto is a fast concurrent cache library in Go. In the upcoming version, the cache is B-tree based. In this, the keys and values are stored in one flat slice of []uint64. Call this node. [Read More]

Some Thoughts On Library Design

This post was [originally published in GopherAcademy](https://blog.gopheracademy.com/advent-2019/pkgapi/) for their Advent 2019 series. It's been republished here for posterity. As programmers we use libraries a lot. But library design is hard. In this article, I will walk through some considerations in designing a library. We will start by bifurcating the acts of programming. We start by casting the act of programming as conversations. Then we examine the main activities that constitute what people call “programming”. [Read More]

The Y-Combinator MBA Project

A friend of mine is doing an MBA. Her course this semester follows the Startup School model - each week they have lectures regarding issues a startup face while creating a startup at the same time. They have to create a product for the startup that they create. They first have to find customers and solve their customers problems, and create a product and startup around the problem. The problem her team discovered was this: Graduating MBA students from her school cannot find jobs in Management Consulting, citing the lack of project experience as the reason. [Read More]

Writing Clearly is Clearly Hard

These days I am slow in my blogging. I am trying to write my thoughts out more clearly. I don't think I am very good at it. Consider this snippet of conversation: Chewxy: Star Wars is typical Campbellism. and here I use the word "typical" in the typical fashion which is to say, not the usual connotation of "usual" what I meant is "a representative of a type" where " [Read More]

Go is a Pretty Average Language

But OCaml is Pretty Great

I had a data visualization problem at work. I’ve been thinking about set coverage issues, and wanted to test some ideas for visualizations. I had wanted to visualize the space of aggregate measures (i.e. things like means, etc). It later transpired that I didn’t need it, because my thinking around the issue had been wrong to begin with. I had written some code, and was eager to check it out. By the end of it, it had morphed into something entirely different, but it was a good entertaining night last night nonetheless. [Read More]

A Most Vivid Dream

I have had the most vivid and unusual dream that I feel compelled to note it down for posterity. Or for future self-introspection. It’s too long to write in my notebook and I feel more comfortable typing it out anyways. In the dream I was at a birthday party of a friend of mine. It had gone particularly wrong - I was the organizer and I had arranged for logistics to cater for two children. [Read More]

Deceptively Simple Is Deceptively Simple

I recently used the words “deceptively simple” to describe lambda calculus. One person reading my paper sent a comment back: “do you mean ‘deceptively complicated’?”. What I had meant to say was on the surface, lambda calculus looks simple. But when you consider all the meta conditions of alpha-renaming and substitutions - you know, practical things about programming - then it isn’t. It turns out the phrase “deceptively simple” requires disambiguation - it means one of two diametrically opposite meanings: [Read More]

Namespaces Are Useful

Or: How I Got Bitten by the Dot Import Gotcha

I was extending Gorgonia for a project of mine when I rapidly ran into a dot-import gotcha in Go. Specifically I was trying to implement a fused version of the Conv2d function that exists. The current Conv2d function works well, if you want to do image convolution related work. It could be quite a bit faster (if anyone from Intel is reading, I’d love some help in the same way Intel boosted the speeds of Caffe), but that’s not really the concern - different convolution algorithms have different performance characteristics, and should be used accordingly. [Read More]

Do You Need Deep Learning?

As a guy who has his own deep learning library that aims to rival Tensorflow and PyTorch, the answer is: “chances are, no”. Around this time last year, I was running a startup and as a side hustle, I was doing consulting work for any parties interested in machine learning. I get a lot of requests from businesses who want to empower their businesses with “AI”. The results from any successful consults*Don't let terms like " [Read More]

How To Use Go Interfaces

I occasionally give free Go consults and code review on top of my daily work. As such, I tend to read a lot of other peoples’ codes. And while this is really more of a feeling *Now, you should go, really? You're a statistician by training ffs, I’ve seen an increase in what I call “Java-style” interface usage.

This blog post is a Go specific recommendation from me, based on my experiences writing Go code, on how to use interfaces well.

For this blog post, the running example will span two packages: animal and circus. A lot of what I write about here is about code at the boundary of packages.

[Read More]