URI::Encode::XS - a Perl URI encoder/decoder using C
use URI::Encode::XS qw/uri_encode uri_decode/; my $encoded = uri_encode($data); my $decoded = uri_decode($encoded);
This is a Perl module that wraps my C URI encoder/decoder based on RFC3986. This module always encodes characters that are not unreserved.
I've benchmarked it and found it significantly faster than URI::Escape at encoding and decoding:
Rate escape encode escape 141724/s -- -96% encode 3491116/s 2363% -- Rate unescape decode unescape 193807/s -- -96% decode 4835488/s 2395% --
However this is just one string - the fewer encoded/decoded characters are in the string, the closer the benchmark is likely to be (see bench for details of the benchmark). Different hardware will yield different results.
bench
Another fast encoder/decoder which supports custom escape lists, is URI::XSEscape.
$ cpan URI::Encode::XS
Or
$ git clone https://github.com/dnmfarrell/URI-Encode-XS $ cd URI-Encode-XS $ perl Makefile.PL $ make $ make test $ make install
See LICENSE
© 2016 David Farrell
To install URI::Encode::XS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm URI::Encode::XS
CPAN shell
perl -MCPAN -e shell install URI::Encode::XS
For more information on module installation, please visit the detailed CPAN module installation guide.