Go Quicksort
Around when the Google programming langauge Go came out I caught wind of it and decided to try it out a little bit. I never ended up doing much with it, though I found it interesting, but thought it’s OOP model was too different for me to use. But one of the first things I did do was write a concurrent Quicksort using their concurrency natives, goroutines. I was astonished at how easy it was considering how much more difficult it is (and how much more code it takes) in C++. The performance also blew me away. Recently I’ve been getting interested in Go again, and decided to revisit my old quicksort implementation, which I still had archived on an old hard drive. I made some adjustments and came up with this:
Using the Go Sandbox I was astonished to find that this both compiled and then ran and sorted an array of 10,000 random integers in less than 2 seconds. I wouldn’t be able to get the same results in any other language (except Erlang, if I knew it better).
When I first started playing with Go a couple of years ago I was still deeply a C++ and Python programmer, and was so set in my Class-based OOP ways. Since then I’ve become something of a JavaScript Junkie and have opened up to different methods of Object Oriented Programming. Coming back to Go I find it not as frustratingly different and confusing as before. Instead I’m finding it to be an extremely satisfying way to write efficient systems. I’ve started on a simple load balancer for one of my current projects using Go, and it is surprisingly easy.
I think Go is definitely the C/C++ of the future. It keeps the safe, fast feel of C and C++, while being more modern and easier to use, and not nearly as fickle. Anyone with any experience in C-like languages or even scripting languages like Python should find Go easy to learn. They even have a tool on their home page for you to try Go without installing it, I’d encourage trying it out.
Subscribe to the RSS feed and have all new posts delivered straight to you.