New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.read is better than "open". #1336

Merged
merged 1 commit into from Jul 6, 2013

Conversation

Projects
None yet
2 participants
@namusyaka
Member

namusyaka commented Jul 5, 2013

File.read is faster than open.

require 'benchmark'

Benchmark.bm do |x|
  x.report { 1000.times do ; open("foo.txt").read; end }
  x.report { 1000.times do ; File.read("foo.txt"); end }
end
       user     system      total        real
   0.030000   0.000000   0.030000 (  0.034196)
   0.020000   0.010000   0.030000 (  0.024281)

Ortuna added a commit that referenced this pull request Jul 6, 2013

@Ortuna Ortuna merged commit 99c3c13 into padrino:master Jul 6, 2013

1 check passed

default The Travis CI build passed
Details
@Ortuna

This comment has been minimized.

Show comment
Hide comment
@Ortuna

Ortuna Jul 6, 2013

Member

Thanks!

Member

Ortuna commented Jul 6, 2013

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment