3 ms·
Hey despite the poor performance this post taught me a lot about Ruby. Thanks! I did wonder.. doesn’t readlines load the entire file into RAM? Would it be more
by jchook 8y ago
Hey despite the poor performance this post taught me a lot about Ruby. Thanks!
I did wonder.. doesn’t readlines load the entire file into RAM? Would it be more performance to try, e.g.
File.open(filename).inject(0) { |c, line| c + 1 }