-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process files in parallel to improve performance #113
Conversation
Yesssssssss I ❤️ parallelization. Is this really all it takes? It seems so simple. |
Yep, at least the tests pass and it resulted in the same errors on my website. Props to the parallel gem for making this a breeze 🎉 |
Only problem could be if there's some shared state that the threads try to access/modify concurrently, but from what I glanced this is not the case? |
One suggestion I would make: I don't like libraries I write (that depend on other libraries) to disregard their options. Could you set up a way to pass options along to Parallel, similar to what's being done with Typhoeus? That way any consumer of this can pass along If you get that working, docs + tests for it would be grand! Otherwise I can pick it up. Thanks! |
Hmm, I tried to add it, but I think something doesn't work, as I can't even pass a different Typhoeues option to the library. Output on master without any changes: $ htmlproof _site --followlocation=false
/home/alexander/.rvm/gems/ruby-2.1.1/gems/mercenary-0.3.4/lib/mercenary/program.rb:30:in `go': invalid option: --followlocation=false (OptionParser::InvalidOption)
from /home/alexander/.rvm/gems/ruby-2.1.1/gems/mercenary-0.3.4/lib/mercenary.rb:22:in `program'
from /home/alexander/dev/html-proofer/bin/htmlproof:10:in `<top (required)>'
from /home/alexander/.rvm/gems/ruby-2.1.1/bin/htmlproof:23:in `load'
from /home/alexander/.rvm/gems/ruby-2.1.1/bin/htmlproof:23:in `<main>'
from /home/alexander/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
from /home/alexander/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>' |
Yeah, I thought as much. Typhoeus is real picky about its options. Gonna merge this and work on the options in a separate PR. |
Process files in parallel to improve performance
I love it. |
So by default this will use two processes? |
By default it should use whatever Parallel's defaults are. |
Hm, okay. |
Not sure if you want to take it, but this improved performance for me as well (i.e. it now saturates all my four cores instead of only one).
Sample improvement for our website (both timings with PR #112 applied) on my four core machine: