Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers

ArticlesSpeed Tips for Java Coders


May 1998 / Cover Story / How To Soup Up Java / Speed Tips for Java Coders

Java developers don't have to wait for fancy new compilers and other whizbang technologies to make their programs run faster. It's possible to achieve major gains in performance simply by writing (surprise!) better code.

Strangely enough, Sun engineers discourage programmers from using too many clever tricks. As Java evolves, some tricks won't work anymore, they point out. "In effect, you're writing to a specific VM implement ation, and that doesn't make sense. You're doing damage to your code," says Tim Lindholm, a senior staff engineer at JavaSoft and coauthor of The Java Virtual Machine Specification (Addison-Wesley, 1997).

This is especially true when the tricks compromise good object-oriented program (OOP) design. For example, liberal use of Java's final keyword does make programs run a little faster, because the JVM knows a program can't subclass final classes, override final methods, or alter final data members. But final makes code reuse more difficult -- and code reuse is what OOP is all about.

"There's a lot of pretty rotten code being written out there," says Collette Coad, the U.S. leader for Java-based computing at Ernst & Young. "People attend a few Java courses and then revert back to old habits. They're writing scripted Java programs or procedural Java programs. They're not embracing the concepts of OO."

You're better off studying good des ign and algorithms -- classic computer science. However, if you absolutely must squeeze the last drop of performance out of Java, here are some tips from experts:


Probing Builds a Profile

screen_link (36 Kbytes)

A profiling tool such as KL Group's JProbe can show which classes and methods a Java program calls most often.


Up to the Cover Story section contentsGo to previous article: Benchmarking Java
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network