NAME

Image::TextMode::Reader::ANSI::XS - Fast ANSI image parsing

SYNOPSIS

# The XS reader will automatically be used instead of the pure-perl version
my $ansi = Image::TextMode::Format::ANSI->new
$ansi->read( shift );

DESCRIPTION

To parse an ANSI file, we use a simple state machine and examine each character individually. This proves to be a little on the slow side in pure-perl form.

This module endeavors to re-implement the parsing in XS/C. The results show a major speed increase; about 25 times faster.

INSTALLATION

perl Makefile.PL
make
make test
make install

METHODS

_read( $image, $fh, \%options )

This is an XS-based version of Image::TextMode::Reader::ANSI's method of the same name.

BENCHMARK

Image::TextMode version 0.12
Image::TextMode::Reader::ANSI::XS version 0.05
Filesize: 75501 bytes
Benchmark: timing 50 iterations of PP, XS...
        PP: 43 wallclock secs (42.25 usr +  0.04 sys = 42.29 CPU) @  1.18/s (n=50)
        XS:  2 wallclock secs ( 2.11 usr +  0.03 sys =  2.14 CPU) @ 23.36/s (n=50)
     Rate    PP    XS
PP 1.18/s    --  -95%
XS 23.4/s 1876%    --

AUTHOR

Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2009-2011 by Brian Cassidy

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.