mirror of
https://github.com/lightbend/config.git
synced 2025-01-25 19:50:09 +08:00
Change CatchExceptionOnMissing bench to have more stack frames
This commit is contained in:
parent
891a2cde97
commit
c5b2572858
@ -112,6 +112,15 @@ object HasPathOnMissing extends App {
|
|||||||
object CatchExceptionOnMissing extends App {
|
object CatchExceptionOnMissing extends App {
|
||||||
val conf = ConfigFactory.parseString("aaaaa.bbbbb.ccccc.d=42,x=10, y=11, z=12").resolve()
|
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() {
|
def task() {
|
||||||
try conf.getInt("aaaaa.bbbbb.ccccc.e")
|
try conf.getInt("aaaaa.bbbbb.ccccc.e")
|
||||||
catch {
|
catch {
|
||||||
@ -119,8 +128,10 @@ object CatchExceptionOnMissing extends App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val ms = Util.time(task, 3000000)
|
anotherStackFrame(40) { () =>
|
||||||
println("CatchExceptionOnMissing: " + ms + "ms")
|
val ms = Util.time(task, 300000)
|
||||||
|
println("CatchExceptionOnMissing: " + ms + "ms")
|
||||||
|
|
||||||
Util.loop(args, task)
|
Util.loop(args, task)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user