aspose file tools*
The moose likes Beginning Java and the fly likes How to adjust myself to JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to adjust myself to JAVA" Watch "How to adjust myself to JAVA" New topic
Author

How to adjust myself to JAVA

Tracy Tse
Greenhorn

Joined: May 24, 2010
Posts: 22
Hi Jeff:
I used to be a JAVA fan when i first learned JAVA,but now i like C++ the best.Every time a idea hit me, my first response is how to implement it in C++.I know that JAVA is relatively simple and safe comparing to C++, but it is quite slow.

My puzzle is that i love android phone and wanna do something in the android development world.But i just hate coding in JAVA,there got to be a time for me to adjust myself.


Whatever it takes is what i have got !
Lift is the best sitcom!
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Tracy Tse wrote:but it is quite slow.


Hmm. it is java 1.7 now . slow? nope. there are many discussion here in javaranch regarding this.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Tracy Tse wrote:... I know that JAVA is ... quite slow...

Why do you say this?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Jeff Friesen
author
Ranch Hand

Joined: Sep 19, 2010
Posts: 41
Hi Tracy,

In its early days, Java was quite a dog speedwise. However, the introduction of a just-in-time compiler and other improvements to the Java runtime environment have greatly improved Java's performance.

I believe that the main reason for slow Java applications lies with how those applications are coded. For example, an application that constantly allocates memory for objects and arrays, and releases this memory via null reference assignments may see the garbage collector run more often, which can provide intermittent pauses in the application's execution. (I call such pauses "hiccups".)

There are many ways to improve performance, and here are a few suggestions:

1) reuse objects

2) use System.arraycopy() to copy one array to another

3) take advantage of String internment for String comparisons

My book dives deep into the Java language, explaining such things as String internment. It also points out where you can directly access an object's private fields and call its private methods (for performance) without having to rely on the Reflection API (which is slow). I believe that a solid understanding of the language will help the developer create better-performing applications, and providing this knowledge is what I have attempted to achieve in my book.

Regarding Android, you might find the Inside the Android Application Framework video to be enlightening. Among other things, Google's Dan Morrill suggests that Java need not be the only way to create Android apps.

All the best.

Jeff

http://javajeff.mb.ca
Tracy Tse
Greenhorn

Joined: May 24, 2010
Posts: 22
Jeff Friesen wrote:Hi Tracy,

In its early days, Java was quite a dog speedwise. However, the introduction of a just-in-time compiler and other improvements to the Java runtime environment have greatly improved Java's performance.

I believe that the main reason for slow Java applications lies with how those applications are coded. For example, an application that constantly allocates memory for objects and arrays, and releases this memory via null reference assignments may see the garbage collector run more often, which can provide intermittent pauses in the application's execution. (I call such pauses "hiccups".)

There are many ways to improve performance, and here are a few suggestions:

1) reuse objects

2) use System.arraycopy() to copy one array to another

3) take advantage of String internment for String comparisons

My book dives deep into the Java language, explaining such things as String internment. It also points out where you can directly access an object's private fields and call its private methods (for performance) without having to rely on the Reflection API (which is slow). I believe that a solid understanding of the language will help the developer create better-performing applications, and providing this knowledge is what I have attempted to achieve in my book.

Regarding Android, you might find the Inside the Android Application Framework video to be enlightening. Among other things, Google's Dan Morrill suggests that Java need not be the only way to create Android apps.

All the best.

Jeff

Thanks for your advice.I need to re-consider JAVA.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to adjust myself to JAVA