Last active
August 29, 2015 14:02
-
-
Save natemurthy/47149eff62bf8fe45bfa 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
// map.scala | |
object `map` { | |
def main (args: Array[String]) { | |
val start = System.nanoTime | |
println("\n(Map) multiplying 60 million elements by 2") | |
val dbls = (1L to 60000000L).toArray.map(_*2) | |
println("(Reduce) sum: %d".format(dbls.sum)) | |
val end = System.nanoTime | |
println("Total MapReduce time: %f".format((end-start)/1.0e9)) | |
} | |
} | |
// breeze_map.scala | |
import breeze.linalg.DenseVector | |
object breeze_map { | |
def main(args: Array[String]): Unit = { | |
val start = System.nanoTime | |
println("\n(Map) multiplying 60 million elements by 2") | |
val dbls = DenseVector((1L to 60000000L).toArray) :* 2L | |
println("(Reduce) sum: %d".format(dbls.sum)) | |
val end = System.nanoTime | |
println("Total MapReduce time: %f".format((end-start)/1.0e9)) | |
} | |
} | |
// saddle_map.scala | |
import org.saddle.{Vec, Series} | |
object saddle_map { | |
def main(args: Array[String]): Unit = { | |
val start = System.nanoTime | |
println("\n(Map) multiplying 60 million elements by 2") | |
val dbls = Series(Vec((1L to 60000000L).toArray))*2L | |
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