Am 08.01.20 um 22:37 schrieb MG:
These results look great, Daniel G-) With regards to nomenclature: What is your definition of megamorphic as compared to polymorphic ? The web does not seem to be in complete agreement on these terms - I assume you are referring to the number of call site cache entries needed (monomorphic: 1, polymorphic: > 1, megamorphic: > cache size) ?
monomorphic: any number of calls of one type only polymorphic: any number of calls of at max cachesize different types megamorphic: any number of calls of more than max cachesize different types In Java a cal of the structure x.foo(bar) is of one type if the type of x does not change, the type of bar is not relevant beyond the first selection, since we expect static method selection. If the declaration type of x is final, then in theory you do not even need to check the receiver type of x later. In Groovy we have dynamic method selection, thus we need to check x and bar all the time, plus code for categories and methods added/replaced through meta classes. So the number of call types will be much higher in Groovy, even for Java style code and only in very specific situations this could be different. Plus some more clutter with when we actually have the information about the to be selected method. bye Jochen