Issue #14410 has been updated by sam.saffron (Sam Saffron).


Yes, tests appear to be passing. 

I went with the atomic version here cause there is a giant string Hash and it is way cleaner to apply it to the entire file then work through every string in the Hash 

----------------------------------------
Feature #14410: Reduce allocations and retained objects in the uri common module
https://bugs.ruby-lang.org/issues/14410#change-69908

* Author: sam.saffron (Sam Saffron)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Patch at: 

https://github.com/ruby/ruby/pull/1801 

require 'memory_profiler'

MemoryProfiler.report do
  require 'uri'
end.pretty_print

Before:

Total allocated: 986643 bytes (15159 objects)
Total retained:  246370 bytes (2532 objects)

After: 

Total allocated: 926903 bytes (13665 objects)
Total retained:  208570 bytes (1587 objects)

--- 

Quite a significant change, almost 1000 less RVALUEs around when you require 'uri' which almost every web app does.

See also: https://ruby-talk.trydiscourse.com/t/psa-string-memory-use-reduction-techniques/74477/13?u=samsaffron

To explain [-i.chr]



---Files--------------------------------
diff.txt (1.49 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>