Rate perl xs
perl 386/s -- -67%
xs 1179/s 206% --
####
use strictures;
use Template;
use Benchmark "cmpthese";
my $tt2 = Template->new();
my $template = do { local $/; };
cmpthese 10_000, {
xs => sub {
$tt2->process(\qq{[% USE MultiMarkdown(implementation => "XS") -%] $template},
{}, \my $toss)
or die $tt2->error; },
perl => sub {
$tt2->process(\qq{[% USE MultiMarkdown(implementation => "PP") -%] $template},
{}, \my $toss)
or die $tt2->error; } };
__DATA__
[% FILTER multimarkdown %]
An h1 header
============
Use 3 dashes---for an em-dash. Use 2 dashes for ranges (ex. "it's all
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
Bulleted list--
* this one
* that one
* the other one
> Block quotes are written like so.
Paragraphs are separated by a blank line. Obviously.
[% END %]
####
wget http://search.cpan.org/CPAN/authors/id/A/AN/ANDREWF/Text-MultiMarkdown-XS-0.001_03.tar.gz
gnutar xpfvz Text-MultiMarkdown-XS-0.001_03.tar.gz
cd Text-MultiMarkdown-XS-0.001_03
# add "use IO::Handle;" to Makefile.PL
make Makefile.PL
make
make test
make install
# Might need "sudo make install"