perl-AutoXS - Speed up your code after compile time
||ALT Linux Sisyphus
*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.
the AutoXS::Accessor manpage comes with the same distribution as an example plugin.
the AuotXS manpage plugins use the the B manpage and the B::Utils manpage 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 the Inline::C manpage would do.
They have been compiled at module build time just like any other XSUBs.
In a simple minded test, the AuotXS::Accessor manpage 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 the AutoXS::Accessor manpage)
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.
- Add the following line to /etc/apt/sources.list:
rpm [Sisyphus] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/Sisyphus i586 autoimports
rpm [Sisyphus] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/Sisyphus noarch autoimports
- Update the package index:
# sudo apt-get update
- Install perl-AutoXS rpm package:
# sudo apt-get install perl-AutoXS