Skip to content

Commit

Permalink
[ruby/logger] Prefer String#[0, 1] over [0..0]
Browse files Browse the repository at this point in the history
[0..0] internally creates an extra Array object, and so is slower and much more memory consuming

ruby/logger@20616ad34a
  • Loading branch information
amatsuda authored and matzbot committed May 5, 2022
1 parent 4f25971 commit 0b62535
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/logger/formatter.rb
Expand Up @@ -13,7 +13,7 @@ def initialize
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

Expand Down

0 comments on commit 0b62535

Please sign in to comment.