Skip to content

Instantly share code, notes, and snippets.

@DanielleSucher
Last active December 19, 2015 01:09
Show Gist options
  • Save DanielleSucher/5873871 to your computer and use it in GitHub Desktop.
Save DanielleSucher/5873871 to your computer and use it in GitHub Desktop.
Case versus If in Ruby
n = 1 (last clause matches)
if: 7.4821e-07
threequal_if: 1.6830500000000001e-06
case: 3.9176999999999997e-07
n = 15 (first clause matches)
if: 3.7357000000000003e-07
threequal_if: 5.0263e-07
case: 4.3348e-07
== disasm: <RubyVM::InstructionSequence:<main>@./case.rb>===============
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 15
0004 setlocal_OP__WC__0 2
0006 trace 1 ( 2)
0008 getlocal_OP__WC__0 2
0010 dup
0011 opt_case_dispatch <cdhash>, 35
0014 dup ( 3)
0015 putobject 15
0017 checkmatch 2
0019 branchif 42
0021 dup ( 5)
0022 putobject 5
0024 checkmatch 2
0026 branchif 49
0028 dup ( 7)
0029 putobject 3
0031 checkmatch 2
0033 branchif 56
0035 pop ( 10)
0036 trace 1
0038 getlocal_OP__WC__0 2
0040 leave
0041 pop
0042 pop ( 11)
0043 trace 1 ( 4)
0045 putstring "fifteen"
0047 leave ( 11)
0048 pop
0049 pop
0050 trace 1 ( 6)
0052 putstring "five"
0054 leave ( 11)
0055 pop
0056 pop
0057 trace 1 ( 8)
0059 putstring "three"
0061 leave ( 10)
number = 15
case number
when 15
'fifteen'
when 5
'five'
when 3
'three'
else
number
end
puts "CASE\n"
seq = RubyVM::InstructionSequence.compile_file("./case.rb")
puts seq.disassemble
puts "IF\n"
seq = RubyVM::InstructionSequence.compile_file("./if.rb")
puts seq.disassemble
module Fleem
def self.case(number)
case number
when 15
:fleem
when 14
:fleem
when 13
:fleem
when 12
:fleem
when 11
:fleem
when 10
:fleem
when 9
:fleem
when 8
:fleem
when 7
:fleem
when 6
:fleem
when 5
:fleem
when 4
:fleem
when 3
:fleem
when 2
:fleem
when 1
:fleem
else
number
end
end
def self.if(number)
if number == 15
:fleem
elsif number == 14
:fleem
elsif number == 13
:fleem
elsif number == 12
:fleem
elsif number == 11
:fleem
elsif number == 10
:fleem
elsif number == 9
:fleem
elsif number == 8
:fleem
elsif number == 7
:fleem
elsif number == 6
:fleem
elsif number == 5
:fleem
elsif number == 4
:fleem
elsif number == 3
:fleem
elsif number == 2
:fleem
elsif number == 1
:fleem
else
number
end
end
def self.threequal_if(number)
if number === 15
:fleem
elsif number === 14
:fleem
elsif number === 13
:fleem
elsif number === 12
:fleem
elsif number === 11
:fleem
elsif number === 10
:fleem
elsif number === 9
:fleem
elsif number === 8
:fleem
elsif number === 7
:fleem
elsif number === 6
:fleem
elsif number === 5
:fleem
elsif number === 4
:fleem
elsif number === 3
:fleem
elsif number === 2
:fleem
elsif number === 1
:fleem
else
number
end
end
end
require 'benchmark'
def test_method(method, n)
time = Benchmark.realtime {
100000.times do
Fleem.send method, n
end
}
time/100000
end
GC.disable
n = 1
puts "n = #{n}"
puts "if: #{test_method(:if, n)}"
puts "threequal_if: #{test_method(:threequal_if, n)}"
puts "case: #{test_method(:case, n)}"
n = 15
puts "n = #{n}"
puts "if: #{test_method(:if, n)}"
puts "threequal_if: #{test_method(:threequal_if, n)}"
puts "case: #{test_method(:case, n)}"
== disasm: <RubyVM::InstructionSequence:<main>@./if.rb>=================
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 15
0004 setlocal_OP__WC__0 2
0006 trace 1 ( 2)
0008 getlocal_OP__WC__0 2
0010 putobject 15
0012 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0014 branchunless 22
0016 trace 1 ( 3)
0018 putstring "fifteen"
0020 leave ( 2)
0021 pop
0022 getlocal_OP__WC__0 2 ( 4)
0024 putobject 5
0026 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0028 branchunless 36
0030 trace 1 ( 5)
0032 putstring "five"
0034 leave ( 4)
0035 pop
0036 getlocal_OP__WC__0 2 ( 6)
0038 putobject 3
0040 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0042 branchunless 50
0044 trace 1 ( 7)
0046 putstring "three"
0048 leave ( 6)
0049 pop
0050 trace 1 ( 9)
0052 getlocal_OP__WC__0 2
0054 leave
number = 15
if number == 15
'fifteen'
elsif number == 5
'five'
elsif number == 3
'three'
else
number
end
THREEQUAL_IF_15
== disasm: <RubyVM::InstructionSequence:<main>@./threequal_if_15.rb>====
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 15
0004 setlocal_OP__WC__0 2
0006 trace 1 ( 2)
0008 getlocal_OP__WC__0 2
0010 putobject 15
0012 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0014 branchunless 22
0016 trace 1 ( 3)
0018 putobject :fleem
0020 leave ( 2)
0021 pop
0022 getlocal_OP__WC__0 2 ( 4)
0024 putobject 14
0026 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0028 branchunless 36
0030 trace 1 ( 5)
0032 putobject :fleem
0034 leave ( 4)
0035 pop
0036 getlocal_OP__WC__0 2 ( 6)
0038 putobject 13
0040 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0042 branchunless 50
0044 trace 1 ( 7)
0046 putobject :fleem
0048 leave ( 6)
0049 pop
0050 getlocal_OP__WC__0 2 ( 8)
0052 putobject 12
0054 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0056 branchunless 64
0058 trace 1 ( 9)
0060 putobject :fleem
0062 leave ( 8)
0063 pop
0064 getlocal_OP__WC__0 2 ( 10)
0066 putobject 11
0068 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0070 branchunless 78
0072 trace 1 ( 11)
0074 putobject :fleem
0076 leave ( 10)
0077 pop
0078 getlocal_OP__WC__0 2 ( 12)
0080 putobject 10
0082 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0084 branchunless 92
0086 trace 1 ( 13)
0088 putobject :fleem
0090 leave ( 12)
0091 pop
0092 getlocal_OP__WC__0 2 ( 14)
0094 putobject 9
0096 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0098 branchunless 106
0100 trace 1 ( 15)
0102 putobject :fleem
0104 leave ( 14)
0105 pop
0106 getlocal_OP__WC__0 2 ( 16)
0108 putobject 8
0110 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0112 branchunless 120
0114 trace 1 ( 17)
0116 putobject :fleem
0118 leave ( 16)
0119 pop
0120 getlocal_OP__WC__0 2 ( 18)
0122 putobject 7
0124 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0126 branchunless 134
0128 trace 1 ( 19)
0130 putobject :fleem
0132 leave ( 18)
0133 pop
0134 getlocal_OP__WC__0 2 ( 20)
0136 putobject 6
0138 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0140 branchunless 148
0142 trace 1 ( 21)
0144 putobject :fleem
0146 leave ( 20)
0147 pop
0148 getlocal_OP__WC__0 2 ( 22)
0150 putobject 5
0152 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0154 branchunless 162
0156 trace 1 ( 23)
0158 putobject :fleem
0160 leave ( 22)
0161 pop
0162 getlocal_OP__WC__0 2 ( 24)
0164 putobject 4
0166 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0168 branchunless 176
0170 trace 1 ( 25)
0172 putobject :fleem
0174 leave ( 24)
0175 pop
0176 getlocal_OP__WC__0 2 ( 26)
0178 putobject 3
0180 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0182 branchunless 190
0184 trace 1 ( 27)
0186 putobject :fleem
0188 leave ( 26)
0189 pop
0190 getlocal_OP__WC__0 2 ( 28)
0192 putobject 2
0194 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0196 branchunless 204
0198 trace 1 ( 29)
0200 putobject :fleem
0202 leave ( 28)
0203 pop
0204 getlocal_OP__WC__0 2 ( 30)
0206 putobject_OP_INT2FIX_O_1_C_
0207 opt_send_simple <callinfo!mid:===, argc:1, ARGS_SKIP>
0209 branchunless 217
0211 trace 1 ( 31)
0213 putobject :fleem
0215 leave ( 30)
0216 pop
0217 trace 1 ( 33)
0219 getlocal_OP__WC__0 2
0221 leave
IF_15
== disasm: <RubyVM::InstructionSequence:<main>@./if_15.rb>==============
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 15
0004 setlocal_OP__WC__0 2
0006 trace 1 ( 2)
0008 getlocal_OP__WC__0 2
0010 putobject 15
0012 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0014 branchunless 22
0016 trace 1 ( 3)
0018 putobject :fleem
0020 leave ( 2)
0021 pop
0022 getlocal_OP__WC__0 2 ( 4)
0024 putobject 14
0026 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0028 branchunless 36
0030 trace 1 ( 5)
0032 putobject :fleem
0034 leave ( 4)
0035 pop
0036 getlocal_OP__WC__0 2 ( 6)
0038 putobject 13
0040 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0042 branchunless 50
0044 trace 1 ( 7)
0046 putobject :fleem
0048 leave ( 6)
0049 pop
0050 getlocal_OP__WC__0 2 ( 8)
0052 putobject 12
0054 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0056 branchunless 64
0058 trace 1 ( 9)
0060 putobject :fleem
0062 leave ( 8)
0063 pop
0064 getlocal_OP__WC__0 2 ( 10)
0066 putobject 11
0068 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0070 branchunless 78
0072 trace 1 ( 11)
0074 putobject :fleem
0076 leave ( 10)
0077 pop
0078 getlocal_OP__WC__0 2 ( 12)
0080 putobject 10
0082 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0084 branchunless 92
0086 trace 1 ( 13)
0088 putobject :fleem
0090 leave ( 12)
0091 pop
0092 getlocal_OP__WC__0 2 ( 14)
0094 putobject 9
0096 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0098 branchunless 106
0100 trace 1 ( 15)
0102 putobject :fleem
0104 leave ( 14)
0105 pop
0106 getlocal_OP__WC__0 2 ( 16)
0108 putobject 8
0110 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0112 branchunless 120
0114 trace 1 ( 17)
0116 putobject :fleem
0118 leave ( 16)
0119 pop
0120 getlocal_OP__WC__0 2 ( 18)
0122 putobject 7
0124 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0126 branchunless 134
0128 trace 1 ( 19)
0130 putobject :fleem
0132 leave ( 18)
0133 pop
0134 getlocal_OP__WC__0 2 ( 20)
0136 putobject 6
0138 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0140 branchunless 148
0142 trace 1 ( 21)
0144 putobject :fleem
0146 leave ( 20)
0147 pop
0148 getlocal_OP__WC__0 2 ( 22)
0150 putobject 5
0152 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0154 branchunless 162
0156 trace 1 ( 23)
0158 putobject :fleem
0160 leave ( 22)
0161 pop
0162 getlocal_OP__WC__0 2 ( 24)
0164 putobject 4
0166 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0168 branchunless 176
0170 trace 1 ( 25)
0172 putobject :fleem
0174 leave ( 24)
0175 pop
0176 getlocal_OP__WC__0 2 ( 26)
0178 putobject 3
0180 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0182 branchunless 190
0184 trace 1 ( 27)
0186 putobject :fleem
0188 leave ( 26)
0189 pop
0190 getlocal_OP__WC__0 2 ( 28)
0192 putobject 2
0194 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0196 branchunless 204
0198 trace 1 ( 29)
0200 putobject :fleem
0202 leave ( 28)
0203 pop
0204 getlocal_OP__WC__0 2 ( 30)
0206 putobject_OP_INT2FIX_O_1_C_
0207 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0209 branchunless 217
0211 trace 1 ( 31)
0213 putobject :fleem
0215 leave ( 30)
0216 pop
0217 trace 1 ( 33)
0219 getlocal_OP__WC__0 2
0221 leave
LONG_CASE_1
== disasm: <RubyVM::InstructionSequence:<main>@./long_case_1.rb>========
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 1
0004 setlocal number
0006 trace 1 ( 2)
0008 getlocal number
0010 dup
0011 opt_case_dispatch <cdhash>, 194
0014 putobject 15 ( 3)
0016 topn 1
0018 send :===, 1, nil, 0, <ic:0>
0024 branchif 201
0026 putobject 14 ( 5)
0028 topn 1
0030 send :===, 1, nil, 0, <ic:1>
0036 branchif 208
0038 putobject 13 ( 7)
0040 topn 1
0042 send :===, 1, nil, 0, <ic:2>
0048 branchif 215
0050 putobject 12 ( 9)
0052 topn 1
0054 send :===, 1, nil, 0, <ic:3>
0060 branchif 222
0062 putobject 11 ( 11)
0064 topn 1
0066 send :===, 1, nil, 0, <ic:4>
0072 branchif 229
0074 putobject 10 ( 13)
0076 topn 1
0078 send :===, 1, nil, 0, <ic:5>
0084 branchif 236
0086 putobject 9 ( 15)
0088 topn 1
0090 send :===, 1, nil, 0, <ic:6>
0096 branchif 243
0098 putobject 8 ( 17)
0100 topn 1
0102 send :===, 1, nil, 0, <ic:7>
0108 branchif 250
0110 putobject 7 ( 19)
0112 topn 1
0114 send :===, 1, nil, 0, <ic:8>
0120 branchif 257
0122 putobject 6 ( 21)
0124 topn 1
0126 send :===, 1, nil, 0, <ic:9>
0132 branchif 264
0134 putobject 5 ( 23)
0136 topn 1
0138 send :===, 1, nil, 0, <ic:10>
0144 branchif 271
0146 putobject 4 ( 25)
0148 topn 1
0150 send :===, 1, nil, 0, <ic:11>
0156 branchif 278
0158 putobject 3 ( 27)
0160 topn 1
0162 send :===, 1, nil, 0, <ic:12>
0168 branchif 285
0170 putobject 2 ( 29)
0172 topn 1
0174 send :===, 1, nil, 0, <ic:13>
0180 branchif 292
0182 putobject 1 ( 31)
0184 topn 1
0186 send :===, 1, nil, 0, <ic:14>
0192 branchif 299
0194 pop ( 34)
0195 trace 1
0197 getlocal number
0199 leave
0200 pop
0201 pop ( 35)
0202 trace 1 ( 4)
0204 putobject :fleem
0206 leave ( 35)
0207 pop
0208 pop
0209 trace 1 ( 6)
0211 putobject :fleem
0213 leave ( 35)
0214 pop
0215 pop
0216 trace 1 ( 8)
0218 putobject :fleem
0220 leave ( 35)
0221 pop
0222 pop
0223 trace 1 ( 10)
0225 putobject :fleem
0227 leave ( 35)
0228 pop
0229 pop
0230 trace 1 ( 12)
0232 putobject :fleem
0234 leave ( 35)
0235 pop
0236 pop
0237 trace 1 ( 14)
0239 putobject :fleem
0241 leave ( 35)
0242 pop
0243 pop
0244 trace 1 ( 16)
0246 putobject :fleem
0248 leave ( 35)
0249 pop
0250 pop
0251 trace 1 ( 18)
0253 putobject :fleem
0255 leave ( 35)
0256 pop
0257 pop
0258 trace 1 ( 20)
0260 putobject :fleem
0262 leave ( 35)
0263 pop
0264 pop
0265 trace 1 ( 22)
0267 putobject :fleem
0269 leave ( 35)
0270 pop
0271 pop
0272 trace 1 ( 24)
0274 putobject :fleem
0276 leave ( 35)
0277 pop
0278 pop
0279 trace 1 ( 26)
0281 putobject :fleem
0283 leave ( 35)
0284 pop
0285 pop
0286 trace 1 ( 28)
0288 putobject :fleem
0290 leave ( 35)
0291 pop
0292 pop
0293 trace 1 ( 30)
0295 putobject :fleem
0297 leave ( 35)
0298 pop
0299 pop
0300 trace 1 ( 32)
0302 putobject :fleem
0304 leave ( 34)
LONG_CASE_15
== disasm: <RubyVM::InstructionSequence:<main>@./long_case_15.rb>=======
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] number
0000 trace 1 ( 1)
0002 putobject 1
0004 setlocal number
0006 trace 1 ( 2)
0008 getlocal number
0010 dup
0011 opt_case_dispatch <cdhash>, 194
0014 putobject 15 ( 3)
0016 topn 1
0018 send :===, 1, nil, 0, <ic:0>
0024 branchif 201
0026 putobject 14 ( 5)
0028 topn 1
0030 send :===, 1, nil, 0, <ic:1>
0036 branchif 208
0038 putobject 13 ( 7)
0040 topn 1
0042 send :===, 1, nil, 0, <ic:2>
0048 branchif 215
0050 putobject 12 ( 9)
0052 topn 1
0054 send :===, 1, nil, 0, <ic:3>
0060 branchif 222
0062 putobject 11 ( 11)
0064 topn 1
0066 send :===, 1, nil, 0, <ic:4>
0072 branchif 229
0074 putobject 10 ( 13)
0076 topn 1
0078 send :===, 1, nil, 0, <ic:5>
0084 branchif 236
0086 putobject 9 ( 15)
0088 topn 1
0090 send :===, 1, nil, 0, <ic:6>
0096 branchif 243
0098 putobject 8 ( 17)
0100 topn 1
0102 send :===, 1, nil, 0, <ic:7>
0108 branchif 250
0110 putobject 7 ( 19)
0112 topn 1
0114 send :===, 1, nil, 0, <ic:8>
0120 branchif 257
0122 putobject 6 ( 21)
0124 topn 1
0126 send :===, 1, nil, 0, <ic:9>
0132 branchif 264
0134 putobject 5 ( 23)
0136 topn 1
0138 send :===, 1, nil, 0, <ic:10>
0144 branchif 271
0146 putobject 4 ( 25)
0148 topn 1
0150 send :===, 1, nil, 0, <ic:11>
0156 branchif 278
0158 putobject 3 ( 27)
0160 topn 1
0162 send :===, 1, nil, 0, <ic:12>
0168 branchif 285
0170 putobject 2 ( 29)
0172 topn 1
0174 send :===, 1, nil, 0, <ic:13>
0180 branchif 292
0182 putobject 1 ( 31)
0184 topn 1
0186 send :===, 1, nil, 0, <ic:14>
0192 branchif 299
0194 pop ( 34)
0195 trace 1
0197 getlocal number
0199 leave
0200 pop
0201 pop ( 35)
0202 trace 1 ( 4)
0204 putobject :fleem
0206 leave ( 35)
0207 pop
0208 pop
0209 trace 1 ( 6)
0211 putobject :fleem
0213 leave ( 35)
0214 pop
0215 pop
0216 trace 1 ( 8)
0218 putobject :fleem
0220 leave ( 35)
0221 pop
0222 pop
0223 trace 1 ( 10)
0225 putobject :fleem
0227 leave ( 35)
0228 pop
0229 pop
0230 trace 1 ( 12)
0232 putobject :fleem
0234 leave ( 35)
0235 pop
0236 pop
0237 trace 1 ( 14)
0239 putobject :fleem
0241 leave ( 35)
0242 pop
0243 pop
0244 trace 1 ( 16)
0246 putobject :fleem
0248 leave ( 35)
0249 pop
0250 pop
0251 trace 1 ( 18)
0253 putobject :fleem
0255 leave ( 35)
0256 pop
0257 pop
0258 trace 1 ( 20)
0260 putobject :fleem
0262 leave ( 35)
0263 pop
0264 pop
0265 trace 1 ( 22)
0267 putobject :fleem
0269 leave ( 35)
0270 pop
0271 pop
0272 trace 1 ( 24)
0274 putobject :fleem
0276 leave ( 35)
0277 pop
0278 pop
0279 trace 1 ( 26)
0281 putobject :fleem
0283 leave ( 35)
0284 pop
0285 pop
0286 trace 1 ( 28)
0288 putobject :fleem
0290 leave ( 35)
0291 pop
0292 pop
0293 trace 1 ( 30)
0295 putobject :fleem
0297 leave ( 35)
0298 pop
0299 pop
0300 trace 1 ( 32)
0302 putobject :fleem
0304 leave
def new_if(predicate, then_clause, else_clause)
if predicate
then_clause
else
else_clause
end
end
irb(main):012:0> x = 0
=> 0
irb(main):013:0> new_if(true, x+=1, x+=2)
=> 1
irb(main):014:0> x
=> 3
def new_if(predicate, then_clause, else_clause)
if predicate
then_clause.call
else
else_clause.call
end
end
irb(main):015:0> x = 0
=> 0
irb(main):016:0> new_if(true, lambda { x+=1 }, lambda { x+=2 })
=> 1
irb(main):017:0> x
=> 1
== disasm: <RubyVM::InstructionSequence:<main>@./unless.rb>=============
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
[ 2] n
0000 trace 1 ( 1)
0002 putobject_OP_INT2FIX_O_1_C_
0003 setlocal_OP__WC__0 2
0005 trace 1 ( 2)
0007 getlocal_OP__WC__0 2
0009 putobject_OP_INT2FIX_O_1_C_
0010 opt_eq <callinfo!mid:==, argc:1, ARGS_SKIP>
0012 branchunless 17
0014 putnil
0015 leave
0016 pop
0017 trace 1 ( 3)
0019 putself
0020 putstring "sadface"
0022 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0024 leave
n = 1
unless n == 1
puts "sadface"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment