On Wed, Jan 02, 2013 at 12:04:21PM +1100, Daniel Bryan wrote:
> On the other hand, it's not the fact that Java 7 is compiled that makes it
> less efficient than the interepreted bash - it's the fact that Java 7 is just
> reading files and filling buffers, whereas Bash is doing a dozen
> fork+execs.
Yes. It's possible to implement pipelines and parallel tasks using
coroutines in Java 7, which is a little scary / weird but can be very efficient.
Coroutines can be used with multi-threading, using a worker thread per core.
http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
But for many tasks, it's simplisticr just to fork! I seldom find the shell
with its process-happy approach becomes too slow or heavy.
Received on Wed Jan 02 2013 - 02:13:13 CET