Created
September 13, 2015 09:52
-
-
Save cielavenir/503bb004ed91307c78c7 to your computer and use it in GitHub Desktop.
ダブルクオートとシングルクオートの速度差は(ほぼ)ない ref: http://qiita.com/cielavenir/items/3bbb4e483df8ba03de03
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
%q(x=5;puts "aaa #{x**3}") |
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
irb> RubyVM::InstructionSequence.compile(%q(x=5;puts "aaa #{x**3}")).to_a | |
=> ["YARVInstructionSequence/SimpleDataFormat", 2, 0, 1, {:arg_size=>0, :local_size=>2, :stack_max=>4}, "<compiled>", "<compiled>", nil, 1, :top, [:x], 0, [], [1, [:trace, 1], [:putobject, 5], [:setlocal_OP__WC__0, 2], [:trace, 1], [:putself], [:putobject, "aaa "], [:getlocal_OP__WC__0, 2], [:putobject, 3], [:opt_send_simple, {:mid=>:**, :flag=>256, :orig_argc=>1, :blockptr=>nil}], [:tostring], [:concatstrings, 2], [:opt_send_simple, {:mid=>:puts, :flag=>264, :orig_argc=>1, :blockptr=>nil}], [:leave]]] |
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
irb> RubyVM::InstructionSequence.compile(%q(x=5;puts 'aaa '+(x**3).to_s)).to_a | |
=> ["YARVInstructionSequence/SimpleDataFormat", 2, 0, 1, {:arg_size=>0, :local_size=>2, :stack_max=>4}, "<compiled>", "<compiled>", nil, 1, :top, [:x], 0, [], [1, [:trace, 1], [:putobject, 5], [:setlocal_OP__WC__0, 2], [:trace, 1], [:putself], [:putstring, "aaa "], [:trace, 1], [:getlocal_OP__WC__0, 2], [:putobject, 3], [:opt_send_simple, {:mid=>:**, :flag=>256, :orig_argc=>1, :blockptr=>nil}], [:opt_send_simple, {:mid=>:to_s, :flag=>256, :orig_argc=>0, :blockptr=>nil}], [:opt_plus, {:mid=>:+, :flag=>256, :orig_argc=>1, :blockptr=>nil}], [:opt_send_simple, {:mid=>:puts, :flag=>264, :orig_argc=>1, :blockptr=>nil}], [:leave]]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment