From c5b2572858ae8425a0a9d713dc9d22ccca2b97bb Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 11 Oct 2014 10:52:00 -0400 Subject: [PATCH] Change CatchExceptionOnMissing bench to have more stack frames --- config/src/test/scala/Profiling.scala | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/config/src/test/scala/Profiling.scala b/config/src/test/scala/Profiling.scala index 43025cb3..f1819245 100644 --- a/config/src/test/scala/Profiling.scala +++ b/config/src/test/scala/Profiling.scala @@ -112,6 +112,15 @@ object HasPathOnMissing extends App { object CatchExceptionOnMissing extends App { val conf = ConfigFactory.parseString("aaaaa.bbbbb.ccccc.d=42,x=10, y=11, z=12").resolve() + def anotherStackFrame(remaining: Int)(body: () => Unit): Int = { + if (remaining == 0) { + body() + 123 + } else { + 42 + anotherStackFrame(remaining - 1)(body) + } + } + def task() { try conf.getInt("aaaaa.bbbbb.ccccc.e") catch { @@ -119,8 +128,10 @@ object CatchExceptionOnMissing extends App { } } - val ms = Util.time(task, 3000000) - println("CatchExceptionOnMissing: " + ms + "ms") + anotherStackFrame(40) { () => + val ms = Util.time(task, 300000) + println("CatchExceptionOnMissing: " + ms + "ms") - Util.loop(args, task) + Util.loop(args, task) + } }