Hi Steven. Could you show code which you measure? 2017-06-16 17:17 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
I have been playing a bit with anonymous subclasses, and instances of anon subclasses seem slower to execute code than "regular" subclasses instances, but sometimes they reach equivalent performances (for code defined in anon-subclasses). I don't understand why.
I have a class A with a method m. B is subclass of A with a new method m1. Anon-A is an anonymous class of A which also implements the m1 method.
I did various tests of speed and:
- when executing m, compiled in A, instances of Anon-A are around 10% slower than instances of B
- when executing m1, compiled in B and in Anon-A, performances are equivalent between instances of B and of anon-A
Is that a particular behavior of anonymous subclasses, like their instances can easily find behavior defined in their class but have to perform extra-work to find methods defined in their superclass (which is not anonymous) ? Is that vm related ? Other ?
Steven.