Why Program in Go

Why switch to using Go?

I mean what is special about Go?

I tried to develop a node.js version of the static site generator Jekyll a few months ago. My sample data had 5 blog posts. My reason for switching away from Jekyll was that it had a lot of defects and the error messages that it generated were bizarre.

In other words it did a lot of the things that I wanted, like generating a site with all static content so I could use a Content Delivery Network (CDN) like CloudFront. It also wasted a lot of my time by failing to generate content and not telling me why it did what it did. That was very irritating. I worked on the node.js version of my static site generator for a couple of weeks. It works but it is slow. Running it on 5 blog posts took 16.02 seconds!

That was fairly icky. Node.js was supposed to be fast. Some investigation revealed that the problem was in how data was being used inside the program. The code used node.js hashes for everything and everything was a hash. That resulted in lots of expensive copies of data.

Let's just say that it was my bad and that I had used node.js poorly.

I went back to using Jekyll and suffered.

Four days ago I decided that my pain level with Jekyll was high enough. I was going to try something different. I had stumped across an example of a Go template based site. I thought I would just write a little program in Go and see what it was like.

I ended up writing an entire replacement for Jekyll with a bunch of extensions and add ons that I really needed. On the same set of data it runs in 0.05 seconds. That is 5/100ths of a single second.

Then I ran it on a site with 138 posts. The time was 0.11 seconds. That is fast enough that I can regenerate an entire site every time I make a change to a post.

Now that is a reason to use Go!


•       •       •       •       •       •

Summary: # of Words: 487
Author: Philip J. Schlump
Published On: 2013-10-20

 

Before You Go....

Have you read "Unintend Consinsequences"?

"I laughed so hard it hurt..."
    Rod Brown

"Incredibly funny! Incredibly true!"
    Tad Stevens