diff options
author | Eric Wong <e@80x24.org> | 2016-01-24 09:41:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-01-24 09:41:09 +0000 |
commit | fc8e446d5da1887044c86ed07e8cf2eee6cf2cfd (patch) | |
tree | 9b94f8503954b6534a77c30c6885257e6cb372a3 /lib | |
parent | 3a76adf065889787a300f5001126f3ca83731e27 (diff) | |
download | dtas-fc8e446d5da1887044c86ed07e8cf2eee6cf2cfd.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dtas/format.rb | 2 | ||||
-rw-r--r-- | lib/dtas/partstats.rb | 2 | ||||
-rw-r--r-- | lib/dtas/player/client_handler.rb | 4 | ||||
-rw-r--r-- | lib/dtas/source/mp3gain.rb | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/dtas/format.rb b/lib/dtas/format.rb index 001a444..f378f8e 100644 --- a/lib/dtas/format.rb +++ b/lib/dtas/format.rb @@ -164,7 +164,7 @@ class DTAS::Format # :nodoc: end # deal with HH:MM:SS - t = time.split(/:/) + t = time.split(':') raise ArgumentError, "Bad time format: #{hhmmss}" if t.size > 3 mult = 1 diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb index cd37e0a..9714ebe 100644 --- a/lib/dtas/partstats.rb +++ b/lib/dtas/partstats.rb @@ -160,7 +160,7 @@ becomes: def parse_stats(stats, trim_part, buf) trim_row = [ trim_part ] - buf.split(/\n/).each do |line| + buf.split("\n").each do |line| do_map = true case line when /\A(\S+ \S+ dB)\s/, /\A(Crest factor)\s+-\s/ diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index 7ce9839..a6f5dba 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -422,7 +422,7 @@ module DTAS::Player::ClientHandler # :nodoc: def dpc_format(io, msg) new_fmt = @format.dup msg.each do |kv| - k, v = kv.split(/=/, 2) + k, v = kv.split('=', 2) case k when "type" new_fmt.valid_type?(v) or return io.emit("ERR invalid file type") @@ -497,7 +497,7 @@ module DTAS::Player::ClientHandler # :nodoc: before = src.to_state_hash.inspect sd = src.source_defaults msg.each do |kv| - k, v = kv.split(/=/, 2) + k, v = kv.split('=', 2) case k when "command" src.command = v.empty? ? sd[k] : v 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 |