Created
September 25, 2010 11:15
-
-
Save Mons/596742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use uni::perl; | |
use Benchmark ':all'; | |
use lib::abs; | |
BEGIN {unshift @INC, lib::abs::path 'kraih/lib' } | |
use Mojo::ByteStream 'b';; | |
say $INC{'Mojo/ByteStream.pm'}; | |
my %results; | |
$results{old1} = timethis -1 , sub { b("тестовая строка")->encode('utf8')->decode('utf8') }; | |
$results{old2} = timethis -1 , sub { b("тестовая строка")->encode('utf-8')->decode('utf-8') }; | |
$results{old} = timethis -1 , sub { b("тестовая строка")->encode('utf-8')->decode('utf-8')->encode('utf8')->decode('utf8') }; | |
delete $INC{'Mojo/ByteStream.pm'}; | |
delete $Mojo::{'ByteStream::'}; | |
shift @INC; | |
unshift @INC, lib::abs::path 'mons/lib'; | |
require Mojo::ByteStream; | |
Mojo::ByteStream->import('b'); | |
say $INC{'Mojo/ByteStream.pm'}; | |
$results{new1} = timethis -1 , sub { b("тестовая строка")->encode('utf8')->decode('utf8') }; | |
$results{new2} = timethis -1 , sub { b("тестовая строка")->encode('utf-8')->decode('utf-8') }; | |
$results{new} = timethis -1 , sub { b("тестовая строка")->encode('utf-8')->decode('utf-8')->encode('utf8')->decode('utf8') }; | |
cmpthese \%results; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment