On 24.08.2016 20:42, Raviteja Lokineni wrote:
Hi all,

Just wanted to gather feedback on which is preferred and why? benchmarks
too, if any?

Indy source: http://www.groovy-lang.org/indy.html

I googled it up and found these:

  * 
http://stackoverflow.com/questions/29812958/execution-of-bubble-sort-is-5-times-slower-with-indy
  * 
http://blackdragsview.blogspot.com/2015/01/indy-and-compilestatic-as-tag-team-to.html

What is PIC (from the stack-overflow answer link above), I mean
abbreviation?

PIC means polymorphic inline cache. Example:


def foo(x) {
  x.toString() //1
}

foo(1)           //2
foo("a string")  //3
foo(1G)          //4

during runtime the places 1-4 will be call sites, places of method calls in this case. The callsites in 2-4 always use the same type, which is why they are called monomorphic. The callsite in 1 is called with 3 different types: int, String, BigDecimal and called polymorphic or megamorpic. The distinction is usually done by how many different types the polymorphic version allows before it turns megamorphic. A PIC is then a cache with a fast method call path for the n different types the PIC supports There are different approaches to this, so I hope I am forgiven for a little bit of oversimplification. Anyway... Java supports I think a PIC of 3, Groovy currently has only monomorphic versions.... or a PIC of size 1. Well, worse actually, we miss the fallback for the megamorphic sites. This is the same for Groovy with and without indy. The difference is that the setup code in indy takes much longer than the older callsite caching code based on runtime class generation.

But this is something which will be fixed in the future.. for indy. for the runtime class generation approach I am unsure

bye Jochen


Reply via email to