Closed jreidinger closed 1 year ago
Reproduced the failure with:
rm -rf build
mkdir build
cd build
cmake ..
make -j`nproc`
../tests/yast_spec.rb
BTW I've tried enabling frozen string literals to see what memory effect it has, but fast_gettext does not like it, starting here
$ ruby --enable=frozen-string-literal -r ../tests/test_helper.rb ../profiling/yast_import.rb |& o
/usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0/lib/fast_gettext/vendor/mofile.rb:52:in `force_encoding': can't modify frozen String (FrozenError)
from /usr/lib64/ruby/gems/2.5.0/gems/fast_gettext-1.6.0/lib/fast_gettext/vendor/mofile.rb:52:in `<class:MOFile>'
...
Then, as I was documenting it, I looked at your Exportable optimization and realized that it can be improved :smile:
(I've added the under_scores manually)
before frozen path Total allocated: 31_308_339 bytes (353285 objects) Total retained: 4_718_083 bytes (46366 objects)
with frozen path: note that it does not affect the retained values Total allocated: 31_289_098 bytes (352803 objects) Total retained: 4_718_083 bytes (46366 objects)
with global string freeze (would need the above fix in fast_gettext) Total allocated: 30_608_658 bytes (335792 objects) Total retained: 4_685_883 bytes (45561 objects)
pairs instead of name+type hashes, without global string freeze Total allocated: 31_116_547 bytes (352806 objects) Total retained: 4_545_259 bytes (46366 objects)
pairs instead of name+type hashes, with global string freeze Total allocated: 30_436_107 bytes (335795 objects) Total retained: 4_513_059 bytes (45561 objects)
I really wonder how this performs on a real workload
@jreidinger later, I think it is worth looking at the retained foo part of the memory_profiler
report, but for a real workload, not just for an initial import like your test
:heavy_check_mark: Public Jenkins job #70 successfully finished :heavy_check_mark: Created OBS submit request #1077500
:heavy_check_mark: Internal Jenkins job #58 successfully finished :heavy_check_mark: Created IBS submit request #304735
Problem
Agame and also yast consume quite bit of memory, so lets try to optimize it.
Solution
Add some profiling code and based on it, apply some optimization.
Optimization results ( testing on Leap15.4 so with ruby 2.5 ) just totals:
Original result:
after first optimization:
after second optimization:
So result is roughly saved 2650 KiB of allocated and in persistent it is 1021 KiB on testing sample that just require yast and imports some yast modules.