forked from nothingmuch/try-tiny
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We already explicitly save the value of $@ - local()ization is not ne…
…eded 511c05c introduced an extension to try{} - unlike in an eval{} a try{} block has access to the previous value of $@. Since we already have a copy, we can do a manual restore of $@ instead of the expensive local() mechanism. Results in a 7% speedup of bare try{} on 5.16
- Loading branch information
Showing
4 changed files
with
43 additions
and
31 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,5 @@ | |
\.gitignore$ | ||
|
||
MYMETA | ||
|
||
maint |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env perl | ||
|
||
use warnings; | ||
use strict; | ||
|
||
use Benchmark::Dumb ':all'; | ||
use Try::Tiny; | ||
|
||
my $max = 10_000; | ||
|
||
cmpthese('0.003', { | ||
eval => sub { do { local $@; eval { die 'foo' } } for (1..$max) }, | ||
try => sub { do { try { die 'foo' } } for (1..$max) }, | ||
}); |