From fc8e446d5da1887044c86ed07e8cf2eee6cf2cfd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 24 Jan 2016 09:41:09 +0000 Subject: String#split with a single-byte instead of regexp This reduces memory usage as a Regexp object is hundreds of bytes and a single-byte string object is only 40 bytes that is deduped within the VM. --- lib/dtas/source/mp3gain.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dtas/source/mp3gain.rb') diff --git a/lib/dtas/source/mp3gain.rb b/lib/dtas/source/mp3gain.rb index e33b48a..47b24c6 100644 --- a/lib/dtas/source/mp3gain.rb +++ b/lib/dtas/source/mp3gain.rb @@ -16,7 +16,7 @@ module DTAS::Source::Mp3gain # :nodoc: case @infile when String @infile =~ /\.mp[g23]\z/in or return - qx(%W(mp3gain -s c #@infile)).split(/\n/).each do |line| + qx(%W(mp3gain -s c #@infile)).split("\n").each do |line| case line when /^Recommended "(Track|Album)" dB change:\s*(\S+)/ tmp["REPLAYGAIN_#{$1.upcase}_GAIN"] = $2 -- cgit v1.2.3-24-ge0c7