Skip to content

Instantly share code, notes, and snippets.

@johnskopis
Created August 15, 2013 17:35
Show Gist options
  • Save johnskopis/6242850 to your computer and use it in GitHub Desktop.
Save johnskopis/6242850 to your computer and use it in GitHub Desktop.
#!/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