diff options
author | aycabta <aycabta@gmail.com> | 2020-02-25 20:32:07 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-03-26 17:41:21 +0900 |
commit | ffbb162f1a052054ce2864d2971e83da10f8aa78 (patch) | |
tree | 732be1527ff92fd268d6449fbbf69e00f9d10ae1 /thread_pthread.c | |
parent | b08c1bea3632062d0689affac4e0e78523349af0 (diff) |
[ruby/irb] Detect multiple lines output simplify
The old implementation performance test code:
require 'objspace'
puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
/\A.*\Z/ !~ ('abc' * 20_000_000)
puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
and run `time test.rb`:
2.5868 MB
62.226 MB
real 0m1.307s
user 0m0.452s
sys 0m0.797s
The new implementation performance test code:
require 'objspace'
puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
('abc' * 20_000_000).include?("\n")
puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
and run `time test.rb`:
2.5861 MB
62.226 MB
real 0m0.132s
user 0m0.088s
sys 0m0.042s
https://github.com/ruby/irb/commit/40d6610baf
Diffstat (limited to 'thread_pthread.c')
0 files changed, 0 insertions, 0 deletions