|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
Easy Learn Java: Programming Articles, Examples and Tips - Page 385
Previous
1060 Stories (530 Pages, 2 Per Page)
Next
Ergonomics in the 5.0 Java Virtual Machine
|
Getting the best performance out of the JVM has often required detailed hand
tuning of command line options. Yet many users never set command line options
for performance. In order to give the best possible performance in a variety of
situations Sun Microsystems has improved the performance of the JVM even when no
command line options are used.
In J2SE 5.0 the default selection for the garbage collector, heap size, and
runtime compiler are now chosen automatically. These new selections better match
the needs of different types of applications while requiring less command line
tuning.
In addition a different way of tuning the heap has been added for the throughput
garbage collector. This new tuning allows the user to specify performance and
memory utilization criteria to dynamically tune the sizes of the heap. This
"self tuning" behavior is referred to in this document as "ergonomics". For
more on ergonomics please see the
Ergonomics in the 5.0 Java Virtual Machine document.
The performance improvements from ergonomics are significant. Here we compare
SPECjbb2000 performance between J2SE 1.4.2 and J2SE 5.0.
Actual graphs and full article please read
here
comments? | | Score: 0
|
Posted by jalex on Tuesday, July 19, 2005 (00:00:00) (3034 reads)
|
Is it possible to measure time in nanoseconds?
|
Use public static long nanoTime(), since 1.5
- Returns the current value of the most precise available system timer, in
nanoseconds.
This method can only be used to measure elapsed time and is not related
to any other notion of system or wall-clock time. The value returned
represents nanoseconds since some fixed but arbitrary time (perhaps in the
future, so values may be negative). This method provides nanosecond
precision, but not necessarily nanosecond accuracy. No guarantees are made
about how frequently values change. Differences in successive calls that
span greater than approximately 292 years (263 nanoseconds) will
not accurately compute elapsed time due to numerical overflow.
For example, to measure how long some code takes to execute:
long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
-
- Returns:
- The current value of the system timer, in nanoseconds.
The method System.nanoTime() has been added, providing access to
a nanosecond-granularity time source for relative time measurements. The actual
precision of the time values returned by System.nanoTime() is
platform-dependent.
comments? | | Score: 0
|
Posted by jalex on Monday, July 18, 2005 (00:00:00) (11573 reads)
|
|
|