Skip to content

Instantly share code, notes, and snippets.

@v-yarotsky
Created August 30, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v-yarotsky/3dcf86ad408a8786d8ad2b22c1269780 to your computer and use it in GitHub Desktop.
Save v-yarotsky/3dcf86ad408a8786d8ad2b22c1269780 to your computer and use it in GitHub Desktop.
Just stop using anonymous classes already
require 'benchmark/ips'
class A; end
foo = Class.new
Benchmark.ips do |t|
t.report("normal") { A.name }
t.report("anonymous") { foo.name }
end
__END__
normal 4.361M (±18.4%) i/s - 20.631M
anonymous 1.291k (± 8.3%) i/s - 6.440k
@danilotsr
Copy link

😱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment