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

Binary MMD vtable fucntions are in

11 views
Skip to first unread message

Dan Sugalski

unread,
Oct 7, 2003, 8:56:06 AM10/7/03
to perl6-i...@perl.org
I figured out why my MMD code was failing (off by one errors. D'oh!) and
fixed it, with the fixes checked in. Two-arg multimethod dispatch now
works. (More bizarrely, it's actually *faster* to use Integer PMCs, which
do MMD, than it is to use PerlInt PMCs, which don't do MMD. Go figure :)

I'll see about getting some docs into the system so this stuff is actually
usable.

One thing that the current MMD system does *not* do is inherited methods.
PerlInt isa perlscalar isa scalar, but adding a MMD method on a scalar
doesn't do anything for PerlInts. That needs to be addressed.

Dan

Leopold Toetsch

unread,
Oct 8, 2003, 7:11:02 AM10/8/03
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski <d...@sidhe.org> wrote:

> ... (More bizarrely, it's actually *faster* to use Integer PMCs, which


> do MMD, than it is to use PerlInt PMCs, which don't do MMD. Go figure :)

I don't have that here (Athlon). They are equally fast. PerlInts have
some overhead due to possible type morphing, though.

> I'll see about getting some docs into the system so this stuff is actually
> usable.

That would be really necessary. I've some troubles to follow the flow of
execution with MMD and how all these methods play together.

> One thing that the current MMD system does *not* do is inherited methods.
> PerlInt isa perlscalar isa scalar, but adding a MMD method on a scalar
> doesn't do anything for PerlInts. That needs to be addressed.

I've put in vtable->isa() sou you could do something like:

forall p (pmcs)
if p->isa(SELF->name) && p->type != SELF->type
add_mmd_meth(p)

> Dan

leo

Dan Sugalski

unread,
Oct 8, 2003, 11:47:49 AM10/8/03
to Leopold Toetsch, perl6-i...@perl.org
On Wed, 8 Oct 2003, Leopold Toetsch wrote:

> Dan Sugalski <d...@sidhe.org> wrote:
>
> > ... (More bizarrely, it's actually *faster* to use Integer PMCs, which
> > do MMD, than it is to use PerlInt PMCs, which don't do MMD. Go figure :)
>
> I don't have that here (Athlon). They are equally fast. PerlInts have
> some overhead due to possible type morphing, though.

Hrm. This system's showing the PerlInt at about 25% slower for a tight
division loop, though that's the most expensive case)

> > I'll see about getting some docs into the system so this stuff is actually
> > usable.
>
> That would be really necessary. I've some troubles to follow the flow of
> execution with MMD and how all these methods play together.

Prelim docs are in.

Dan

Leopold Toetsch

unread,
Oct 8, 2003, 12:41:43 PM10/8/03
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski <d...@sidhe.org> wrote:
> On Wed, 8 Oct 2003, Leopold Toetsch wrote:

>> I don't have that here (Athlon). They are equally fast. PerlInts have
>> some overhead due to possible type morphing, though.

> Hrm. This system's showing the PerlInt at about 25% slower for a tight
> division loop, though that's the most expensive case)

Have it too now. It depends on the values. 10/2 (my original) is same
speed, 10/3 gives your oberved 25%. Its due to morphing the result to an
PerlNum.

BTW:

$ time perl -e'$a=10;$b=2; $i=5000000; $c=$a/$b for 0..$i'

real 0m3.955s

$ parrot -P mmd.imc # 10/3; unoptimized build, Athlon 800
1.507748
2.018662

$ parrot -j mmd.imc
1.319433
1.640584

> Prelim docs are in.

Thanks.

> Dan

leo

:r src/parrot-leo/mmd.imc
.sub _main
P0 = new Integer
P1 = new Integer
P2 = new Integer
P1 = 10
P2 = 3
I0 = 5000000
time N0
l1:
P0 = P1 / P2
dec I0
if I0 goto l1
time N1
sub N1, N0
print N1
print "\n"

P0 = new PerlInt
P1 = new PerlInt
P2 = new PerlInt
P1 = 10
P2 = 3
I0 = 5000000
time N0
l2:
P0 = P1 / P2
dec I0
if I0 goto l2
time N1
sub N1, N0
print N1
print "\n"
end
.end

0 new messages