Let scripts/gather-test-memory-data use less memory
What does this MR do and why?
This MRs improves slighly the memory efficiency (lowering max resident set size - see below) of scripts/gather-test-memory-data
by streaming content instead of slurping into memory when merging CSVs to ensure constant memory usage.
Screenshots or screen recordings
The resulting report.csv
remains identical:
md5sum report.csv tmp/memory_test/report.csv
a3c99010e44c35af051ed856cc33bed6 report.csv
a3c99010e44c35af051ed856cc33bed6 tmp/memory_test/report.csv
Note the maxresident
below (35204
15044
).
Before
/usr/bin/time ruby <path-to-gdk>/scripts/gather-test-memory-data
0.42user 0.05system 0:00.41elapsed 114%CPU (0avgtext+0avgdata 35204maxresident)k
0inputs+3240outputs (1major+35794minor)pagefaults 0swaps
After
/usr/bin/time ruby <path-to-gdk>/scripts/gather-test-memory-data
0.38user 0.05system 0:00.38elapsed 115%CPU (0avgtext+0avgdata 15044maxresident)k
0inputs+3240outputs (0major+30725minor)pagefaults 0swaps
How to set up and validate locally
- From https://gitlab.com/gitlab-org/gitlab/-/jobs/2039704476
- Download archive https://gitlab.com/gitlab-org/gitlab/-/jobs/2039704476/artifacts/download
- Unzip archive in e.g.
/tmp/
- Move already generated
tmp/memory_test/report.csv
out of the way viamv tmp/memory_test/report.csv .
- Useful for verifying the output later via
md5sum
(see above)
- Useful for verifying the output later via
- Run
/usr/bin/time ruby <path-to-gdk>/scripts/gather-test-memory-data
- Verify that generated
tmp/memory_test/report.csv
matchesreport.csv
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen