Created
August 15, 2013 17:35
-
-
Save johnskopis/6242850 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
#!/usr/bin/env ruby | |
# | |
require 'active_support/core_ext' | |
require 'benchmark' | |
class FooException < StandardError; end | |
def fun(depth = 0) | |
if depth == 150 | |
raise FooException, 'message' | |
end | |
fun(depth + 1) | |
rescue FooException => error | |
raise error, caller.reject { |l| l.starts_with? __FILE__ } | |
end | |
begin | |
result = Benchmark.measure { | |
100.times do | |
begin | |
begin | |
fun | |
rescue => error | |
# raise error, caller.reject { |l| l.starts_with? __FILE__ } | |
raise error | |
end | |
rescue => e | |
print e | |
end | |
end | |
} | |
rescue | |
ensure | |
print result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment