develooper Front page | perl.perl6.internals | Postings from February 2001

Re: PDD 2, vtables

February 7, 2001 08:47
Re: PDD 2, vtables
Message ID:
Nicholas Clark wrote:
> ++ and -- are already slightly messy in perl5
> pp_preinc, pp_postinc, pp_predec and pp_postdec live in with all the ops.
> They know how to increment and decrement integers that don't overflow,
> and call routines in sv.c to increment and decrement anything else.
> Actually, this nearly provides a divide between values and operators
> that has been suggested, with the speed up hack for the common case.
> Nicholas Clark

I guess everything (including get/set, add/sub/mul/...) could have a speed
up hack for the common case. The vtables (or PMC's flags as well) could have
a flag that indicate ``No tying and no overloading here, nothing special,
just another plain old variable''. Every operation would check the `special'
flag of the values it operates, and do the right thing on them. Otherwise,
call the vtable for the generic way of doing it.

I _think_ this would be a great speed up if the program doesn't use much
magic, but perhaps the overhead would be too big and make tying slower than
in Perl 5... something to consider tough.

- Branden Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About