A simple PIC api
Jochen Theodorou
blackdrag at gmx.org
Wed Mar 18 13:37:42 UTC 2015
Am 16.03.2015 00:42, schrieb Mark Roos:
> Jochen writes
> So far I have avoided using projections since I am not sure
> about how to
> do this. Basically I am missing a way to project a Class to an
> usable
> int.
>
> After this discussion, reading Rémi's suggested paper and some more
> analysis of my code base
> I am beginning to think that a projection based PIC could be a good
> solution. I agree with your
> concern about how such a projection would be computed but I feel that
> there is a solution for
> that. Hopefully it will hold up in reality.
I was waiting a while to see if maybe somebody else jumps in and gives a
suggestion...
I had a bad experience once with trying to make a key for a method
selection for caching in a hashmap. This is kind of an projection as
well. But anyway... in the end the caching there costs almost as much as
doing the method selection and the gain is near zero. An we are here the
focus is not the cost of method selection so much as more an efficient
way to compute an int out of receiver and arguments , which will be more
efficient than a cascade of guards where each checks the classes for a
cached call. In both cases you would have to get the classes of the
arguments and the receiver once. And in both cases you would need a loop
to check over the classes, unless you can be sure that your projection
will be bimorphic. And I doubt that would be the case. At least not
bimorphic and efficient to compute at the same time.
So in the end it is a question of what can be optimized better.
bye Jochen
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
More information about the mlvm-dev
mailing list