Skip to content

Instantly share code, notes, and snippets.

@natemurthy
Last active August 29, 2015 14:04
Show Gist options
  • Save natemurthy/019e49e6f5f0d1be8719 to your computer and use it in GitHub Desktop.
Save natemurthy/019e49e6f5f0d1be8719 to your computer and use it in GitHub Desktop.
object `map` {
def main (args: Array[String]) {
val start = System.nanoTime
println("\n(Map) multiplying 20 million elements by 2")
val dbls = (1L to 20000000L).map(_*2)
//val dbls = (1L to 20000000L).toArray.map(_*2)
//val dbls = (1L to 20000000L).toVector.map(_*2)
//val dbls = (1L to 20000000L).par.map(_*2)
println("(Reduce) sum: %d".format(dbls.sum))
val end = System.nanoTime
println("Total MapReduce time: %f".format((end-start)/1.0e9))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment