Replace gsub with tr

Using `tr` is faster than `gsub` when replacing a single character in a string with another single character
This commit is contained in:
John Bampton
2022-10-26 17:34:03 +10:00
parent 20617017df
commit 1626758ccc
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ module MRuby
end
def funcname
@funcname ||= @name.gsub('-', '_')
@funcname ||= @name.tr('-', '_')
end
def compilers
+1 -1
View File
@@ -44,7 +44,7 @@ ARGV.each do |gem|
case RbConfig::CONFIG['host_os']
when /mswin(?!ce)|mingw|bccwin/
gem = gem.gsub('\\', '/')
gem = gem.tr('\\', '/')
end
Dir["#{gem}/bintest/**/*.rb"].each do |file|