imgo / imgo

Image optimization tool
http://imgo.github.com/imgo
317 stars 36 forks source link

Многопоточность xargs #49

Open ghost opened 11 years ago

ghost commented 11 years ago

Original: http://jetpackweb.com/blog/2010/02/24/optimize-your-pngs-with-optipng/

_man xargs_

     -n number
             Set the maximum number of arguments taken from standard input for each invocation
             of utility.  An invocation of utility will use less than number standard input
             arguments if the number of bytes accumulated (see the -s option) exceeds the speci-
             fied size or there are fewer than number arguments remaining for the last invoca-
             tion of utility.  The current default value for number is 5000.

     -P maxprocs
             Parallel mode: run at most maxprocs invocations of utility at once.

Example: find <folder> -iname '*.png' -print0 | xargs -n 1 -P 16 -0 optipng -o7 -n = кол-во потоков приложения -P = кол-во файлов (аргументов), обрабатываемых одним потоком

banzalik commented 11 years ago

Интересный вариант, я подумаю как его правильней прикрутить, но скорей всего будет переезд на node.js

ghost commented 11 years ago

но скорей всего будет переезд на node.js

@banzalik, Со своим блекджеком или опять же все эти тулзкиты под разными лицензиями ?

banzalik commented 11 years ago

То, что есть сейчас (бардак с разными утилитами) + пару шлюх.

storenth commented 3 years ago

Не совсем верно даны определения аргументов xargs:

-n = кол-во одновременно считываемых аргументов поданных на вход за раз
-P = максимальное количество одновременно запущенных процессов вызываемых команд (по дефолту 1)