Re: Writing apps for Windows platform in Java? Why?
- From: G.T. <mlgn@xxxxxxxxxx>
- Date: Sun, 25 Jun 2006 14:45:03 -0400
On Sat, 24 Jun 2006 22:55:05 -0500, Scirious <scirious@xxxxxxxxxxxx>
wrote:
I don't know about the future but I've just done a test now and Java ran
a lot faster then .NET. If you wanna test yourself just do the
following: Create a simple GUI with a text area and a button. On a
button click event put the following code:
JAVA
String st = "a";
for (int i = 0; i < 30000; i++ ) {
textArea.setText(st);
st += "a";
}
System.exit(0);
C#
string st = "a";
for (int i = 0; i < 30000; i++ ) {
textArea.Text = st;
st +="a";
}
this.Close();
I cannot speak for the optimal way in Java, but in C# this is an
extremely poor way to implement string concatenation. All but the
most inexperienced C# developer would use an instance of the
StringBuilder class to do string concatenation in a loop. The String
type has some other advantages in .Net but concatenation is not one of
them. I think you'll find the results quite a bit speedier, it would
be interesting to know how the results compare to Java. Also be sure
that when you test C# code you are compiling to Release rather than
Debug and that you have appropriate optimizations turned on.
As always, the effectiveness of the software often has more to do with
the programmers proficiency level in the language he is using rather
than some dependency on the language itself. About 7-8 years ago
there was some sort of VB versus C++ competition, and essentially the
outcome was that a well-seasoned VB programmer could write an
application that ran circles around an equivilent app produced by an
average C++ developer.
.
- Follow-Ups:
- Re: Writing apps for Windows platform in Java? Why?
- From: Scirious
- Re: Writing apps for Windows platform in Java? Why?
- References:
- Writing apps for Windows platform in Java? Why?
- From: Von Clubusev
- Re: Writing apps for Windows platform in Java? Why?
- From: Scirious
- Writing apps for Windows platform in Java? Why?
- Prev by Date: Re: Writing apps for Windows platform in Java? Why?
- Next by Date: Re: Writing apps for Windows platform in Java? Why?
- Previous by thread: Re: Writing apps for Windows platform in Java? Why?
- Next by thread: Re: Writing apps for Windows platform in Java? Why?
- Index(es):