From 5111742a5a100e44fccf191b12a13c452b025944 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 20 Jan 2022 18:34:17 +0000 Subject: get rid of DTAS.dedupe_str wrapper Ruby 2.3+ supports String#@-, though it did not deduplicate strings. But 2.5 is already old at this point and most users can be expected to have it. This gives some memory regressions for Ruby <= 2.4 users, but cuts down on the code we maintain and reduces bytecode overhead for 2.5+ users. --- lib/dtas.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/dtas.rb') diff --git a/lib/dtas.rb b/lib/dtas.rb index eb8f49d..477a176 100644 --- a/lib/dtas.rb +++ b/lib/dtas.rb @@ -25,19 +25,6 @@ module DTAS Fiddle.dlopen(nil) end end - - # String#-@ will deduplicate strings when Ruby 2.5 is released (Dec 2017) - # https://bugs.ruby-lang.org/issues/13077 - if RUBY_VERSION.to_f >= 2.5 - def self.dedupe_str(str) - -str - end - else - # Ruby 2.1 - 2.4, noop for older Rubies - def self.dedupe_str(str) - eval "#{str.inspect}.freeze" - end - end # :startdoc: end -- cgit v1.2.3-24-ge0c7