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

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

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

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.15
    Image::TextMode::Reader::ANSI::XS version 0.08
    Filesize: 75501 bytes
    Benchmark: timing 50 iterations of PP, XS...
            PP: 42 wallclock secs (40.99 usr +  0.11 sys = 41.10 CPU) @  1.22/s (n=50)
            XS:  2 wallclock secs ( 2.03 usr +  0.05 sys =  2.08 CPU) @ 24.04/s (n=50)
         Rate    PP    XS
    PP 1.22/s    --  -95%
    XS 24.0/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.

syntax highlighting: