Davey wrote:[color=blue]
> Which is typically faster - a Java server application or a C++ server
> application?[/color]
Faster at what? C++ run-time performance is generally superior,
regardless of the current zeitgeist that "nobody should be avoiding Java
for performance reasons." But if you're talking about a long-running,
multithreaded, I/O-bound application, e.g. a web server, the Java
application might actually be faster, and almost certainly will be
faster to develop.
"Jeff Schwab" <jeffrey.schwab @rcn.com> wrote in message
news:uKmdncA9ZK yfbKLeRVn-tA@rcn.net...[color=blue]
> Davey wrote:[color=green]
>> Which is typically faster - a Java server application or a C++ server
>> application?[/color]
>
> Faster at what? C++ run-time performance is generally superior,
> regardless of the current zeitgeist that "nobody should be avoiding Java
> for performance reasons."[/color]
Thanks for the answer.
[color=blue]
> But if you're talking about a long-running, multithreaded, I/O-bound
> application, e.g. a web server,[/color]
Yes, I'm talking about the server-side component of a client-server
application. It will involve reading data from a database and sending the
information to clients apps depending on requests from those apps.
[color=blue]
> the Java application might actually be faster, and almost certainly will
> be faster to develop.[/color]
Davey wrote:[color=blue]
> "Jeff Schwab" <jeffrey.schwab @rcn.com> wrote in message
> news:uKmdncA9ZK yfbKLeRVn-tA@rcn.net...
>[color=green]
>>Davey wrote:
>>[color=darkred]
>>>Which is typically faster - a Java server application or a C++ server
>>>applicatio n?[/color]
>>
>>Faster at what? C++ run-time performance is generally superior,
>>regardless of the current zeitgeist that "nobody should be avoiding Java
>>for performance reasons."[/color]
>
>
> Thanks for the answer.
>
>[color=green]
>>But if you're talking about a long-running, multithreaded, I/O-bound
>>application , e.g. a web server,[/color]
>
>
> Yes, I'm talking about the server-side component of a client-server
> application. It will involve reading data from a database and sending the
> information to clients apps depending on requests from those apps.
>
>[color=green]
>>the Java application might actually be faster, and almost certainly will
>>be faster to develop.[/color]
>
>
> OK, thanks.
>
>[/color]
When C++ behaves badly, it crashes. When java behaves badly, its
not hard to make it local or recoverable.
Java is fast enough on the server side, especially where the database is
likely to be the bottleneck.
The difference in speed doesn't make up for the added safety of java.
Wibble wrote:[color=blue]
> Davey wrote:
>[color=green]
>> "Jeff Schwab" <jeffrey.schwab @rcn.com> wrote in message
>> news:uKmdncA9ZK yfbKLeRVn-tA@rcn.net...
>>[color=darkred]
>>> Davey wrote:
>>>
>>>> Which is typically faster - a Java server application or a C++
>>>> server application?
>>>
>>>
>>> Faster at what? C++ run-time performance is generally superior,
>>> regardless of the current zeitgeist that "nobody should be avoiding
>>> Java for performance reasons."[/color]
>>
>>
>>
>> Thanks for the answer.
>>
>>[color=darkred]
>>> But if you're talking about a long-running, multithreaded, I/O-bound
>>> application, e.g. a web server,[/color]
>>
>>
>>
>> Yes, I'm talking about the server-side component of a client-server
>> application. It will involve reading data from a database and sending
>> the information to clients apps depending on requests from those apps.
>>
>>[color=darkred]
>>> the Java application might actually be faster, and almost certainly
>>> will be faster to develop.[/color]
>>
>>
>>
>> OK, thanks.
>>[/color]
> When C++ behaves badly, it crashes. When java behaves badly, its
> not hard to make it local or recoverable.[/color]
Poorly written C++ code crashes. Poorly written Java code crashes, e.g.
with a NullPointerExce ption. Well written code in either language does
not crash.
[color=blue]
> Java is fast enough on the server side,[/color]
That depends what's being done.
[color=blue]
> especially where the database is
> likely to be the bottleneck.[/color]
True.
[color=blue]
> The difference in speed doesn't make up for the added safety of java.[/color]
The added speed may or may not be worth trading away for Java's
mandatory run-time checks. C++ provides better static safety checks,
and makes many Java-like run-time checks available, just not mandatory.
Davey wrote:[color=blue]
>[color=green]
>>But if you're talking about a long-running, multithreaded, I/O-bound
>>application , e.g. a web server,[/color]
>
>
> Yes, I'm talking about the server-side component of a client-server
> application. It will involve reading data from a database and sending the
> information to clients apps depending on requests from those apps.
>[/color]
In this case, run time performance is a secondary consideration, use the
environment you are most familiar with.
On Sun, 02 Oct 2005 12:19:31 GMT, "Davey" <davey@hotmail. com> wrote or
quoted :
[color=blue]
>Which is typically faster - a Java server application or a C++ server
>application?[/color]
I don't think there would be any contest in who has the better chance
of getting a bug free program first. Java is much better designed for
that.
I would say that a C++ server app, if you allowed say 10 years to
polish the code would do better than the equivalent server app given a
similar length of time, but that does not happen in real life.
What happens in real life is, you have a fixed time budget. The C++
programmer spends it coding. The Java programmer has some time left
over to test and optimise and refactor.
As systems get more complex, it does not matter if they can deliver
wrong answers more quickly. What counts is getting the right answer
in an acceptable length of time.
When I started out, CPUs rented for well over $100 per hour. It thus
made sense to spend considerable programmer to reduce CPU time. Today
the roles are reversed. It pays to spend CPU time to save programmer
time.
--
Canadian Mind Products, Roedy Green. http://mindprod.com Again taking new Java programming contracts.
On Sun, 02 Oct 2005 14:57:00 -0400, Wibble <Wibble@Mailina tor.com>
wrote or quoted :
[color=blue]
>Java is fast enough on the server side, especially where the database is
>likely to be the bottleneck[/color]
or the datacommunicati ons. You can find out which by comparing how
the app behaves on a LAN compared with out there on the web.
--
Canadian Mind Products, Roedy Green. http://mindprod.com Again taking new Java programming contracts.
On Sun, 02 Oct 2005 16:31:02 -0400, Jeff Schwab
<jeffrey.schwab @rcn.com> wrote or quoted :
[color=blue]
>
>Poorly written C++ code crashes. Poorly written Java code crashes, e.g.
>with a NullPointerExce ption. Well written code in either language does
>not crash.[/color]
Consider how large programs are now. If you have probability p
(expressed as number between 0 and 1 e.g. 1/1,000,000) that a given
line contains an error, then the odds of a program N lines long being
perfect is:
N
(1-p)
You see how the math works against you because N, the size of the
program is in the exponent. So in other words, no matter how careful
your programmers, in large programs, errors are unavoidable.
C++ was designed back when programs were small and it was possible to
avoid error with sufficient skill and care.
Java takes a more realistic view that there will inevitably be errors
in large programs no matter who wrote them.
How can you find them? (avoiding pointers, null pointer and array
bounds checks) How can you keep doing even when they happen? (catch)
How can you flush them out? (assertions)
How could we do even better? (design by contract).
Roedy Green wrote:[color=blue]
> C++ was designed back when programs were small and it was possible to
> avoid error with sufficient skill and care.
>
> Java takes a more realistic view that there will inevitably be errors
> in large programs no matter who wrote them.
>
> How can you find them? (avoiding pointers,[/color]
....you can do that in C++, if you like, or use smart pointers such as std::auto_ptr, or boost::shared_p tr
[color=blue]
> null pointer[/color]
Use references instead of pointers.
[color=blue]
> and array bounds checks)[/color]
std::vector.
[color=blue]
> How can you keep doing even when they happen? (catch)[/color]
....like in C++.
[color=blue]
> How can you flush them out? (assertions)[/color]
Roedy Green wrote:[color=blue]
> C++ was designed back when programs were small and it was possible to
> avoid error with sufficient skill and care.
>
> Java takes a more realistic view that there will inevitably be errors
> in large programs no matter who wrote them.[/color]
This is a common misconception made by people who think of C++ as "a
new C". They are two very different languages (even though they
somehow manage to work really well together). IMO, this is good.
You maybe need sufficient skill and care with C, but not with C++.
There is little point comparing Java with C++ (again!) - they, also,
are completely different languages and people use each one based on the
circumstances.
To the OP: use something that you are most comfortable with.
On Mon, 03 Oct 2005 01:43:15 +0100, Ben Pope
<benpope81@_REM OVE_gmail.com> wrote or quoted :
[color=blue]
>...you can do that in C++, if you like, or use smart pointers such as std::auto_ptr, or boost::shared_p tr
>[color=green]
>> null pointer[/color]
>
>Use references instead of pointers.[/color]
Yes you can make C++ safer with extra effort, but normally you are
running without any safety net. In Java the net is mandatory.
There is nothing in C++ to ensure you scrupulously avoided pointers or
invalid casts..
--
Canadian Mind Products, Roedy Green. http://mindprod.com Again taking new Java programming contracts.
That depends on what you are doing and how well the Java and C++ are
written. Different circumstances will yield different results.
The only thing you can say in general is that there's overhead in
initialization of JVM that you are not going to see in C++. If the program
runs for only a few seconds, that time can be significant. If the program
runs for a longer period of time, less so.
Davey wrote:
[color=blue]
> Which is typically faster - a Java server application or a C++ server
> application?[/color]
--
Remove '.nospam' from e-mail address to reply by e-mail
On Sun, 02 Oct 2005 23:43:32 -0400, James McIninch
<james.mcininch .nospam@comcast .net> wrote or quoted :
[color=blue]
>The only thing you can say in general is that there's overhead in
>initializati on of JVM that you are not going to see in C++.[/color]
That is not true for AOT Java, mainly HotSpot Java. Hotspot is
primarily for servers. It does not matter if server apps take 10
minutes to come up to full speed since they will be running for weeks.
AOT Java is not quite as spritely as C, but they don't have a
noticeable delay coming up.
Roedy Green wrote:[color=blue]
> On Mon, 03 Oct 2005 01:43:15 +0100, Ben Pope
> <benpope81@_REM OVE_gmail.com> wrote or quoted :
>
>[color=green]
>>...you can do that in C++, if you like, or use smart pointers such as std::auto_ptr, or boost::shared_p tr
>>
>>[color=darkred]
>>>null pointer[/color]
>>
>>Use references instead of pointers.[/color]
>
>
> Yes you can make C++ safer with extra effort, but normally you are
> running without any safety net. In Java the net is mandatory.
>
> There is nothing in C++ to ensure you scrupulously avoided pointers or
> invalid casts..[/color]
Comment