Scala version 2.10.0-M6 REPL wrap mode

401 views
Skip to first unread message

Ramesh Mandaleeka

unread,
Aug 6, 2012, 9:27:12 AM8/6/12
to scala...@googlegroups.com
Hi,

In the latest release, Scala version 2.10.0-M6, I couldn't find the :wrap option in the power mode. I saw the functionality on Scala 2.9.2 release. Can any one confirm

1/ If this feature is removed or not.
2/ If removed what is the alternative to achieve this functionality. I used to benchmark using scala.testing.Benchmark using :wrap

Regards,
Ramesh

Jason Zaugg

unread,
Aug 6, 2012, 9:40:39 AM8/6/12
to Ramesh Mandaleeka, scala...@googlegroups.com
Yes, it was removed; the REPL shed a few pounds. You'll have to
explicitly call a timing wrapper function now, along these lines:

scala> def time[A](a: => A) = { def now = System.currentTimeMillis; val start
now; val result = a; val end = now; println(end - start); result }
time: [A](a: => A)A

scala> time(for (i <- 1 to 1000000) math.log(1))
27

-jason

√iktor Ҡlang

unread,
Aug 6, 2012, 9:48:45 AM8/6/12
to Jason Zaugg, Ramesh Mandaleeka, scala...@googlegroups.com
I'd recommend avoiding currentTimeMillis, use nanoTime for timings.

Cheers,
--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Ramesh Mandaleeka

unread,
Aug 6, 2012, 9:54:01 AM8/6/12
to √iktor Ҡlang, Jason Zaugg, scala...@googlegroups.com
Thanks much. I'm not sure, if this will be listed in the list of changes of this release.

Regards,
Ramesh
Reply all
Reply to author
Forward
0 new messages