millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

process multiple files in parallel #455

Open millermedeiros opened 8 years ago

millermedeiros commented 8 years ago

something similar to the way jscodeshift works (create multiple child processes and run transforms in parallel).

this should speed things up drastically when processing large codebases.

PS: this is a very good candidate for a dedicated project, maybe there is something on npm that we can reuse.

vjeux commented 7 years ago

Fyi, you can use xargs -n 50 -p 8 to run the command on 8 cores using 50 files at a time.

find src -name '*.js' | xargs -n 50 -p 8 esformatter
millermedeiros commented 7 years ago

see also: https://www.npmjs.com/package/worker-farm

nmaxcom commented 7 years ago

@vjeux I'm probably wrong as it's not my best field but I've read "find -exec" is safer than "find + xargs". Feel free to search or just ignore me :P

vjeux commented 7 years ago

@nmaxcom yeahh, if you have files with quotes or spaces, then you are going to be screwed. But if someone is able to create arbitrary named files on your file system, you are dead anyway, they can just change any js file and run arbitrary code.