Last active
August 29, 2015 14:04
-
-
Save natemurthy/019e49e6f5f0d1be8719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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