perf: reduce peak memory footprint during decoding large images #375
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this patch:
❯ yazi --clear-cache ❯ /usr/bin/time -l ./old 22.66 real 88.54 user 8.89 sys 2953068544 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 729991 page reclaims 544 page faults 0 swaps 0 block input operations 0 block output operations 27 messages sent 26 messages received 27 signals received 45566 voluntary context switches 355342 involuntary context switches 859110694754 instructions retired 249027752894 cycles elapsed 2104009664 peak memory footprint
After this patch:
❯ yazi --clear-cache ❯ /usr/bin/time -l ./new 20.98 real 89.38 user 8.32 sys 2618294272 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 687985 page reclaims 578 page faults 0 swaps 0 block input operations 0 block output operations 27 messages sent 27 messages received 27 signals received 39077 voluntary context switches 330604 involuntary context switches 844330267015 instructions retired 249565769264 cycles elapsed 1593614592 peak memory footprint
A part of #373