?
Solved

Performance and resources

Posted on 2004-11-29
9
Medium Priority
?
170 Views
Last Modified: 2010-05-18
Ola,

How do I determine preformance and recourse used by one technique ( using object a instad of object b ) and comparing it with the performace and recourses of using the other technique ( using object b instead of a )
0
Comment
Question by:DaFou
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12703297
depends how u are judging performance.
timing the task would be one means.
0
 
LVL 2

Author Comment

by:DaFou
ID: 12703358
and in terms of memory usage?
0
 
LVL 2

Author Comment

by:DaFou
ID: 12703361
how do i time a task? please provide examples
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 12703380
long start = System.currentTimeMillis();
performTask();
long stop = System.currentTimeMillis();

long msecs = stop - start;


for short task may you want to repeat it 100 times for example.
0
 
LVL 6

Assisted Solution

by:CodingExperts
CodingExperts earned 500 total points
ID: 12703386
I guess you can take help of a Java Profiler.

http://ejp.sourceforge.net/ is one and well there are many others you can do a googl for one.

-CE
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 12703428
For interactive tasks the judge is the user (everything visibly taking longer than 500 mSec is too long)
For internal processes, use a stopwatch timer (ask times, subtract, measure).
Memory usage is a trade of between speed of processing and speed of storage; up to your limits of course.
<*>
0
 
LVL 7

Assisted Solution

by:tomboshell
tomboshell earned 500 total points
ID: 12703480
for some memory amounts try:

Runtime rTime = Runtime.getRuntime();
long freeMem = rTime.freeMemory();
long maxMem = rTime.maxMemory();
long totalMem = rTime.totalMemory();
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12985229
(:>))

;JOOP!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month17 days, 1 hour left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question