Re: Writing apps for Windows platform in Java? Why?
- From: Scirious <scirious@xxxxxxxxxxxx>
- Date: Sun, 25 Jun 2006 23:28:04 -0500
Well, yet I don't get the milliseconds but with the following code results
were different. the code was:
Java:
Date now = new Date();
DateFormat dt = DateFormat.getTimeInstance(DateFormat.DEFAULT, new Locale
("pt","BR"));
String s = dt.format(now);
jTextArea1.setText(s +"\t");
StringBuilder st = new StringBuilder("a");
for (long i = 0; i < 100000000; i++) {
st.append("a");
}
Date now2 = new Date();
DateFormat dt2 = DateFormat.getTimeInstance(DateFormat.DEFAULT, new Locale
("pt","BR"));
String s2 = jTextArea1.getText() + dt2.format(now2);
jTextArea1.setText(s2);
C#
DateTime dt = DateTime.Now;
textBox1.Text = dt.ToString()+"\t";
StringBuilder st = new StringBuilder("a");
for (int i = 0; i < 100000000; i++) {
st.Append("a");
}
DateTime dt1 = DateTime.Now;
textBox1.Text += dt1.ToString();
I'm not sure if those are the best way to do it in their respective
langages, but the results were:
..NET uses up to 335 MB of RAM and takes up to 5 seconds to finish.
Java uses up to 510 MB of RAM and takes up to 7 seconds to finish.
Actually, I had t start the JVM using the -Xmx550m switch because otherwise
it would cause the OutOfMemoryError exception and would not execute
properly.
Scirious.
.
- Follow-Ups:
- Re: Writing apps for Windows platform in Java? Why?
- From: G . T .
- 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
- Re: Writing apps for Windows platform in Java? Why?
- From: G . T .
- Re: Writing apps for Windows platform in Java? Why?
- From: Scirious
- Re: Writing apps for Windows platform in Java? Why?
- From: G . T .
- 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):