Skip to content

Instantly share code, notes, and snippets.

@cronin101
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save cronin101/8907853 to your computer and use it in GitHub Desktop.

Select an option

Save cronin101/8907853 to your computer and use it in GitHub Desktop.
All of the features
Benchmark.realtime do
File.new('./one_to_a_million.txt')
.readlines.map(&:to_i)
.map { |x| x - 999_990}
.select { |x| x >= 0 }
end
#=> 0.598499
Benchmark.realtime do
File.new('./one_to_a_million.txt')[Int]
.map { |x| x - 999_990 }
.select { |x| x >= 0 }[Fixnum]
end
#=> 0.32548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment