Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Last active January 26, 2016 15:35
Show Gist options
  • Save fedesilva/a415224ac5f789b6932f to your computer and use it in GitHub Desktop.
Save fedesilva/a415224ac5f789b6932f to your computer and use it in GitHub Desktop.
Con y sin println
// The t function takes times and puts data points in an arraybuffer.
// I use that data to compute mean, stddev, variance ...
//
// The Walker just recursively walks a jsoup document feeding the elements to the parser
// or the parsers it returns and accumulating the new ast nodes.
// Lot's of work for the GC
//
// On one run there are two printlns, on the other none.
//
// Run this twice with and without println, see below for numbers.
scala> (0 to 5000).foreach( i => t(JsoupWalker.parse(masterLease, rootParser)) )
scala> stddev(acc)
res1: Double = 1.7753674048360906
scala> mean(acc)
res2: Double = 5.862027594481104
// Same thing but with two printlns enabled (it's one per element)
scala> stddev(acc)
res5: Double = 30.217839527421596
scala> mean(acc)
res6: Double = 84.52829434113177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment