in reply to Re: XS and overload
in thread XS and overload
Overloading is generally quite costly in performance terms. The standard answer to cutting overheads is to drop into XS. I've written an XS based class that for most operations acts like a normal array, but uses custom data structures underneath. It works quite well, but carries the inconvenience of object notation
$obj->set( $n, $obj->get( $n ) + 1 ); instead of
$ary[ $n ]++; for example.
I'd like to reduce that inconvenience without paying too high a price for the syntactic sugar. Using the overload pragma to apply the overloading isn't a problem, but if it is possible to minimise the runtime overheads, that would be nice.
I'm guessing that it would require a pretty full understanding of how and when the overloaded methods get looked up and called to optimise this. Having read the breif passage in perlxs on the OVERLOAD keyword; perused overload.pm; and generally looked around in the sources trying to understand how the pieces fit together I thought I'd ask for references to prior art before beating my brains out trying to understand this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XS and overload
by salva (Canon) on Apr 22, 2006 at 20:21 UTC | |
by BrowserUk (Patriarch) on Apr 22, 2006 at 22:05 UTC |