cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl versus JAVA performance

From: Serge Skorokhodov <ucayalyfish_at_gmail.com>
Date: Mon, 1 Oct 2007 01:57:26 +0400

Hi,

Sorry for a bit offtopic.

>>> I doubt that benchmark exist. But you can always read this page:
>>> http://www.kano.net/javabench/

<skip>

Well, Java seems to do pretty well with recursion, really. Still I you
switch for more efficient iteration versions of algorithms, C/C++ is
~30% better than Java as expected. And -server does worse than
-client. At least it seems to be so for fibonacci sample. Try
something like this:

<java code>
public static int fib2( int n )
{
        int n2 = 0;
        int n1 = 1;
        for ( int i = n; i > 1; --i ) {
                int tmp = n2;
                n2 = n1;
                n1 += tmp;
        }
        return n2 + n1;
}
</java code>

<c code>
unsigned fib2( unsigned n )
{
    unsigned n2 = 0;
    unsigned n1 = 1;
    for ( unsigned i = n; i > 1; --i )
    {
        unsigned tmp = n2;
        n2 = n1;
        n1 += tmp;
    }
    return n1 + n2;
}
</c code>

-- 
The fish that is singing in Ucayaly river...
Received on 2007-10-01