• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

String Object

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

Here is a chunk of a code

Person is Value Object.





Is there any performance difference between code1 and code2 ? if so how?
[ October 09, 2006: Message edited by: vidya sagar ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can write a program yourself to test the performance of those two pieces of code. Or you can compile both pieces of code, decompile them into readable Java byte code with javap, and see if there's any difference in the byte code.

Anyway, I bet that there is no noticeable difference, if there's any difference at all.

Are you attempting to do micro-optimizations yourself? This kind of optimization does not look like something that is worth spending a lot of time on if you're trying to make your program run faster.

If you want to optimize your program, then do this:

1. Analyze the algorithms that you are using in your program. Are you using the most efficient algorithm for the job? If not, use a better algorithm.

2. Run the program through a profiler to find the performance and/or memory usage bottlenecks. Concentrate on that part of your code that causes the bottlenecks.
[ October 09, 2006: Message edited by: Jesper Young ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic