The JVM doesn’t optimize static initializers (which is what this is) to the same level that it optimizes method calls. Unfortunately, when you do a lot of work there, that hurts performance–this is a perfect example of that. This is also one reason why the old Application
trait was considered problematic, and why there is in Scala 2.9 a DelayedInit
trait that gets a bit of compiler help to move stuff from the initializer into a method that’s called later on.
(Edit: fixed “constructor” to “initializer”. Rather lengthy typo!)