kornelski / dssim

Image similarity comparison simulating human perception (multiscale SSIM in Rust)
https://kornel.ski/dssim
GNU Affero General Public License v3.0
1.08k stars 70 forks source link

Excessive memory consumption with multiple modified files in CLI #120

Open homm opened 2 years ago

homm commented 2 years ago
$ /usr/bin/time -v dssim ./art.png ./speed8/art_q30_118971.png
0.02005356  ./speed8/art_q30_118971.png
    User time (seconds): 1.37
    Maximum resident set size (kbytes): 396972

$ /usr/bin/time -v dssim ./art.png ./speed8/art_q3{0,1,2,3}_*.png
0.02005356  ./speed8/art_q30_118971.png
0.01835660  ./speed8/art_q31_130632.png
0.01720346  ./speed8/art_q32_140795.png
0.01625887  ./speed8/art_q33_148772.png
    User time (seconds): 3.56
    Maximum resident set size (kbytes): 687496

$ /usr/bin/time -v dssim ./art.png ./speed8/art_*.png
Command terminated by signal 9
    User time (seconds): 17.01
    Maximum resident set size (kbytes): 1836224

As command is terminated before starting any output, I suppose it tries to load the whole set in memory before any analyzing.

kornelski commented 2 years ago

It does indeed try to load them all at once. As a workaround you can use xargs -n.