Build your own (faster) perl
Random March 27th, 2010
Using the perl that comes with your distribution is usually fine, but it has some limitations. When building a perl for a distribution it needs to be versatile and fit various needs. Therefor ithreads, the perl specific threading implemenation, is enabled there, to allow building modules that require threads to be available.
The downside is, that this threading code adds some quite low-level overhead, which usually means that a perl compiled with threads takes a performance hit of up to about 10%. So it sometimes makes sense to build your own perl, especially if you know it’s going to be used more on the server side, for long-running processes. Saving 10% in CPU cycles means potential for 10% in power saving or giving other processes a chance to run.
Building perl is really straightforward and usually just takes these steps:
- Download the latest stable Perl from perl.org
- Unpack it to a temporary directory
sh Configure -de -Dprefix=/opt/perl5
make && make test && make install
- Perl is now installed in /opt/perl5
Now you can add any additional modules that you like, some recommended ones are:
- App::cpanminus
- Task::Kensho
- Task::Plack
- Task::KiokuDB
- Mojolicious
- Starman
- Starlet
- EV
- AnyEvent
- AnyEvent::MP
- DBIx::Class
- MongoDB
- Data::FormValidator
Using the newly built perl just requires to update your path before starting your perl programs:
export PATH=/opt/perl5/bin:$PATH
/usr/local/bin/myperlprog
After setting the PATH just verify with perl -v
that your perl include path points to /opt/perl5 (or any other path you chose).
- Category: Bits & Bytes A-Tags: CPAN, DBIx::Class, Perl, SysAdmin
- Comments Off on Build your own (faster) perl