Skip to content

Instantly share code, notes, and snippets.

@benlovell
Created January 10, 2013 14:02
Show Gist options
  • Save benlovell/4502221 to your computer and use it in GitHub Desktop.
Save benlovell/4502221 to your computer and use it in GitHub Desktop.
MRI optimises this
(&:+)
= disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 duparray [1, 2, 3, 4, 5]
0004 putobject 0
0006 putobject :+
0008 send :inject, 2, nil, 0, <ic:0>
0014 leave
(:+)
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 duparray [1, 2, 3, 4, 5]
0004 putobject 0
0006 putobject :+
0008 send :inject, 1, nil, 4, <ic:0>
0014 leave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment