• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to adjust myself to JAVA

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


Why do you say this?
 
author
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Tracy Tse
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic