NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Wednesday April 02, 2003
05:02 AM
Class::MethodMaker in XS
I wonder why nobody yet tried to write something like
Class::MethodMaker in XS? I tried to compare pure Perl accessor methods and their XS analogs and the latest was noticibly faster. It would be very nice if we had a CPAN module which provides basic constuctor, accessor and other common methods implemented in XS so everybody could benefit from these speed gains in their Perl OO code without resorting to writting XS themselves.
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Indeed... (Score:2)
Unfortunately I stopped at the "thinking" stage
Interesting idea (Score:2)
Does this mean that XS code for foo() and bar() are generated and compiled on the fly? Or does it just do what Class::MethodMaker does and generate closures bound to *foo and *bar? Can you generate a closure in XS which closes around C code?
-sam
Re:Interesting idea (Score:1)
Ilya Martynov (http://martynov.org/ [martynov.org])
Why are they faster? (Score:1)
Or am I missing the point (or should that be the profile?) here?
-Dom
Re:Why are they faster? (Score:1)
Perl method dispatch is slow but perl code for accessors is not fast also. Here an example (one accessor is implemented in Perl and another in C with help of Inline::C):
Ilya Martynov (http://martynov.org/ [martynov.org])