1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/logger] Prefer String#[0, 1] over [0..0]

[0..0] internally creates an extra Array object, and so is slower and much more memory consuming

https://github.com/ruby/logger/commit/20616ad34a
This commit is contained in:
Akira Matsuda 2022-05-05 18:01:08 +09:00 committed by git
parent 4f25971f05
commit 0b62535219

View file

@ -13,7 +13,7 @@ class Logger
end
def call(severity, time, progname, msg)
Format % [severity[0..0], format_datetime(time), Process.pid, severity, progname,
Format % [severity[0, 1], format_datetime(time), Process.pid, severity, progname,
msg2str(msg)]
end