http://www.powershow.com/view/14655a-MGM5M/Ulterior_Referenc...
Java version doesn't do type conversion: https://github.com/collinvandyck/go-and-java/blob/master/jav...
rs.getString("id")
rs.getBoolean("admin")
Go version does conversion at runtime, as row.Scan() accepts interface values.Also, the usage of sql interface is not optimal (at least with regards to code length) -- since the query is for one row, why not use QueryRow instead of Query?
Authorization header decoding is strange -- it creates new base64 decoder, then string reader, then decodes. Why not just use base64.StdEncoding.DecodeString() and get rid of a few lines of code and a few allocations?
https://github.com/collinvandyck/go-and-java/blob/master/go/...
Similarly, JSON marshals into a newly allocated slice instead of creating a decoder and then marshaling directly into ResponseWriter.
https://github.com/collinvandyck/go-and-java/blob/master/go/...
Constants for HTTP error codes, that are declared in net/http, for some reason are redeclared
https://github.com/collinvandyck/go-and-java/blob/master/go/...
- - -
I sometimes wonder why various benchmarks include colorful charts, but fail to include a few lines from a simple run of profiler. It's so easy to do, and yet nobody bothers to learn where the cycles are actually spent!
Since none of the implementations were IO bound (unsaturated link), I'd bet on memory management as the deciding factor (it's hard to assume that an authentication service will be CPU bound).
Then it's not difficult to see why Java won. When it comes to garbage collectors, JVM has the best (production) implementation of GC bar none.
Go runtime has a lot of catching up to do.