Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Go - A great language for building web applicat...

sporto
September 06, 2013
320

Go - A great language for building web applications

sporto

September 06, 2013
Tweet

Transcript

  1. Bubble sort benchmark #  ruby bubble.call([2,  10,  1,  9,  5,

     6,  8,  3,  7,  4]) //  JS bubble([2,  10,  1,  9,  5,  6,  8,  3,  7,  4]); //  Go arr  :=  []int{2,  10,  1,  9,  5,  6,  8,  3,  7,  4} bubble(arr) Code here
  2. Concurrency - Parallel requests Node.js var  defX  =  Q.defer(); var

     defY  =  Q.defer(); var  oneAndTwo  =  Q  .all([defX.promise,  defY.promise])  .then(processConcat);   requestValue('/x',  defX); requestValue('/y',  defY);
  3. Concurrency - Parallel requests Go var  cx  chan  string  =

     make(chan  string) var  cy  chan  string  =  make(chan  string) go  requestValue("/x",  cx) go  requestValue("/y",  cy) x  :=  <-­‐cx y  :=  <-­‐cy processConcat(x,  y)
  4. #  Run  benchmark ab  -­‐n  10000  -­‐c  100  http://127.0.0.1:8100/ Node.js

    FATAL  ERROR:  (...)  process  out  of  memory Go Time  taken  for  tests:      20.689  seconds Complete  requests:            10000 #  No  problems
  5. Static typing (+ IMO) + More robust + Easier to

    refactor + Less tests + Compiler can go crazy with optimisations + Still flexible (with interfaces) + No ceremony
  6. Single binary + Compile and deploy + No need to

    worry about dependencies, e.g. NPM modules, RubyGems
  7. A lot more + Simple and flexible object system -

    composition + Functions as first class + Closures + Standard formating of source code