Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PIC for more MOPS but not only

2 views
Skip to first unread message

Leopold Toetsch

unread,
Nov 20, 2004, 12:46:43 PM11/20/04
to Perl 6 Internals
Ken Fox ("perl6 Kakapo") has mailed me a link [1] and some hints about
PIC - Polymorphic Inline Cache.

This is quite an interesting idea about dynamic recompiling and caching
of method lookups. And it smells like more MOPS and generally just a
faster Parrot VM. So I've hacked together an initial version for
testing, only MMD lookups currently.

PMC MOPS (examples/benchmarks/mops.pasm)

parrot -C CVS 13.6
parrot -j 13.4
parrot -C PIC 16.7

This is a 22% speedup for MOPS and very likely more for method lookups.
With JIT_CGP the JIT core could also use this optimization.
(Numbers with -O3 build, AMD 800)

Below is a (very) preliminary pod generated from src/pic.c.

Before spending more time on that, I'd like to hear some comments about
possible hidden drawbacks or whatever. I can provide a patch too.

Thanks,
leo

[1] http://citeseer.ist.psu.edu/hlzle91optimizing.html

pic.pod.txt

Leopold Toetsch

unread,
Nov 21, 2004, 9:35:30 AM11/21/04
to Perl 6 Internals
I've now some better timing result, with less loop overhead.

MMD add PerlInt PerlInt 0.698083
MMD add PerlInt INTVAL 0.601620
MMD sub PerlInt PerlInt 0.513797
MMD sub PerlInt INTVAL 0.457096
PIR add PerlInt PerlInt 7.789893
PIR sub PerlInt PerlInt 4.448320

These are 5 million add or sub instructions on AMD 800, --optimize
build. The add isn't cached, the sub opcode is cached. Last two lines
are with overloaded MMD functions.

The speedups are ~34% and 77% respectively. The latter number is
remarkable - due to the recompilation of the sub opcode, it get's
converted to a direct (invokecc-like) function call w/o entering a
second run-loop.

#! perl5_80
use overload '-' => \&my_sub; # here we come (14.5 seconds)

leo


0 new messages