Current version is 0.04.
Distribution from this site.
CPAN site
NAME
AutoXS - Speed up your code after compile time
SYNOPSIS
package MyClass;
sub blah {...}
use AutoXS ':all';
# if blah matches one of the patterns, it's running
# as XS code now!
DESCRIPTION
*Warning:* This module contains some scary code. I'm not even sure it
abides by the official Perl API totally. Furthermore, it's my first
*real* XS module. It abuses some features of the XS/XSUB syntax. If you
break it, you get to keep both halves.
That being said, the purpose of this module and its plugin modules is to
speed up the execution of your program at the expense of a longer
startup time. AutoXS::Accessor comes with the same distribution as an
example plugin.
AuotXS plugins use the B and B::Utils modules to scan all subroutines
(or methods) in the calling package for certain patterns. If a
subroutine complies with such a pattern, it is replaced with an XS
subroutine that has the same function.
The XS subroutines for replacement are *not* compiled at runtime like
Inline::C would do. They have been compiled at module build time just
like any other XSUBs.
In a simple minded test, AuotXS::Accessor sped up typical read-only
accessors by a factor of 1.6 to a factor of 2.5. Your mileage may vary,
of course. Keep in mind mind that accessors can sometimes be part of
very tight loops.
To get an impression of the imposed pre-runtime penalty of using AutoXS,
a file containing nine methods (code shown in AutoXS::Accessor) was
compiled with and without AutoXS. The test is contrived because all nine
methods will be replaced. In normal code, there is much more
non-accessor code which will be quickly rejected. Naturally, rejection
is faster than successful matching and replacement. The compilation with
AutoXS took "74ms" longer than without.
CAVEATS
This is alpha code. Beware.
The module abuses XS syntax constructs.
The startup penalty may be big and is proportional to the number of
subroutines in the calling package.
The module works its magic at CHECK time. CHECK blocks are not executed
in string "eval """ environments. That means this module potentially
does not work in a PAR packaged executable. (It should do no harm there,
either.)
SEE ALSO
AutoXS::Accessor
AutoXS::Header
B, B::Utils
AUTHOR
Steffen Mueller,
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Steffen Mueller
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself, either Perl version 5.8 or, at your
option, any later version of Perl 5 you may have available.
Revision history for Perl extension AutoXS and AutoXS::Accessor.
0.04 Sun May 5 20:31 2008
- Add missing dependency on B::Generate. (Thanks Vincent Pit)
0.03 Fri Apr 4 17:09 2008
- Depend on B::Utils 0.05_06.
- The (getter) Accessor plugin now extracts the hash key name
using the new opgrep() "capture" feature.
- Depend on Class::XSAccessor 0.02.
0.02 Thu Apr 3 17:09 2008
- Move all the XS code to a separate module since the
code may be useful without the funny scanning features.
(See Class::XSAccessor)
0.01 Mon Mar 31 17:09 2008
- original version as uploaded to CPAN.
(c) 2002-2008 Steffen Müller; All rights reserved.