Last active
February 10, 2016 06:10
-
-
Save ziguzagu/987782c34bc8558e6086 to your computer and use it in GitHub Desktop.
URI vs URI::Split (v1.60)
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; use utf8; | |
use Benchmark qw(cmpthese); | |
use URI; | |
use URI::Split qw(uri_split); | |
my $uri = 'https://www.example.com/path/2016/10/my-awesome-photo.jpg?utm=aaa#anchor1'; | |
cmpthese(200000, { | |
'URI' => sub { | |
URI->new($uri)->path; | |
}, | |
'URI::Split' => sub { | |
(uri_split($uri))[2]; | |
}, | |
}); | |
# Rate URI URI::Split | |
# URI 35524/s -- -92% | |
# URI::Split 465116/s 1209% -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment