class CheckPerformanceSuite extends FunSuite {
test("check the performance") {
var start = System.currentTimeMillis()
val vectors = (1 to 3000000).map { i => Vectors.dense(Math.random(), -1 * Math.random(), Math.random())}
var end = System.currentTimeMillis()
println(s"Time for Creating: ${end - start}")
start = System.currentTimeMillis()
vectors.map(v => v.toBreeze.map(x => abs(x)))
end = System.currentTimeMillis()
println(s"Time for mapping breeze.numerics.abs: ${end - start}")
start = System.currentTimeMillis()
vectors.map(v => v.toBreeze.map(x => Math.abs(x)))
end = System.currentTimeMillis()
println(s"Time for mapping Math.abs: ${end - start}")
}
}
Time for Creating: 2049
Time for mapping breeze.numerics.abs: 4025
Time for mapping Math.abs: 2561