-
-
Save edisonywh/60c7d4841e91780cafd64d5145e792f1 to your computer and use it in GitHub Desktop.
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
RubyVM::InstructionSequence.compile_option = { | |
tailcall_optimization: true, | |
trace_instruction: false | |
} | |
require './tail_recursion.rb' | |
large_array = Array.new(500_000).fill { |i| i + 1 } | |
traverse(large_array) | |
# Element: 1 | |
# Element: ... | |
# Element: ... | |
#=> Element: 500000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment