You're right. Java isn't really that slow. I re-examined the Java code for
the standalone program and found I was using an unbuffered output method.
After I changed it to a buffered method, the Java code running time was
comparable to the C++ one. This also means the 1000% speed-up I got was
quite wrong. Hadoop runs Java programs a little more efficiently than hadoop
streaming, but not significantly.

On Mon, Mar 31, 2008 at 3:30 PM, Ted Dunning <[EMAIL PROTECTED]> wrote:

>
>
> This seems a bit surprising.  In my experience well-written Java is
> generally just about as fast as C++, especially for I/O bound work.  The
> exceptions are:
>
> - java startup is still slow.  This shouldn't matter much here because you
> are using streaming anyway so you have java startup + C startup.
>
> - java memory use is larger than a perfectly written C++ program and
> probably always will be.  Of course, getting that perfectly written C++
> program is pretty difficult.
>
> If the program in question is the one you posted earlier, it is very hard
> to
> imagine that java would not saturate the I/O channels.  Can you confirm
> that
> you are literally doing:
>
>    for (node : line.split(" ")) {
>      out.collect(node, key);
>    }
>
> And finding a serious difference in speed?
>
> On 3/31/08 3:23 PM, "lin" <[EMAIL PROTECTED]> wrote:
>
> > Java seems to be too slow. I rewrote the
> > first program in Java and it runs 4 to 5 times slower than the C++ one.
>
>

Reply via email to