What is your code?
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
What is your code?
On Wed, Feb 3, 2016 at 7:44 AM Russ P. <russ.p...@gmail.com> wrote:I just ran with Java -Xprof profiling enabled, and here is a small sample of what I get:Compiled + native Method82.7% 86 + 0 ExceptionBlob2.9% 3 + 0 scala.collection.mutable.WrappedArray.reduceLeft1.9% 2 + 0 scala.collection.mutable.ArrayBuffer.foreachWhat is "ExceptionBlob," and what I should look for in my code to stop it from gobbling up so much time? I don't use exceptions much. Thanks.
That might be an indication that the runtime of your benchmark is dominated by the overhead of throwing/catching exceptions.
--
def foo: Int = {
if (condition) return 1 // early return is still efficient, although many people claim they hamper code readability
val function = () => return 2 // non-local return. this is compiled into `throw new NonLocalReturnException(2) ...
function()
34
// ... and an exception handler is added here to catch that exception and return the value from this method
}