Brian Cassidy > Image-TextMode-Reader-ANSI-XS-0.01 > Image::TextMode::Reader::ANSI::XS

Download:
Image-TextMode-Reader-ANSI-XS-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01   Source   Latest Release: Image-TextMode-Reader-ANSI-XS-0.02

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 ^

Versus Image::TextMode 0.05, parsing 74K of ANSI 25 times yields:

    Benchmark: timing 25 iterations of PP, XS...
            PP: 24 wallclock secs (23.84 usr +  0.00 sys = 23.84 CPU) @  1.05/s (n=25)
            XS:  1 wallclock secs ( 1.00 usr +  0.00 sys =  1.00 CPU) @ 25.00/s (n=25)
         Rate    PP    XS
    PP 1.05/s    --  -96%
    XS 25.0/s 2284%    --

AUTHOR ^

Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2009 by Brian Cassidy

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