Java is not the slowpoke of old days and performance now matches or exceeds applications developed in C, technologists stressed Wednesday during a presentation at TheServerSide Java Symposium in Las Vegas.
Java Virtual Machines and garbage collection, for example, have improved and Java itself has come along way, the technologists argued. Early Java Virtual Machines were indeed slow, said Brian Goetz, Sun senior staff engineer. But that has changed.
"The reality is, Java is pretty fast these days," Goetz said. Java performance now measures up to C but lags behind in memory consumption, he said.
He and Cliff Click, chief JVM architect at Azul Systems, looked to debunk several myths, such as object allocation being slow. "This was one of those things that was absolutely true a long time ago," said Goetz. Garbage collection also was slow because it had to stop programs, trace the heap, and look for objects to discard. "It's not surprising in the early days people came to the conclusion that memory management in Java was really intensive," he said.
Another myth is that synchronisation is slow. But changes have been made such as better locking algorithms, said Goetz. He also noted the continued perpetuation of the myth that Java programs spend 20 percent of their time in garbage collection, a belief traced to a paper written in 1995.
An attendee concurred about Java's performance. "We run a huge J2EE application, and we meet all our service-level agreements all the time," said Jerald Nielson, of Accenture. The program is an automated welfare system for the state of California, he said.
Java has gotten better because of incremental improvements, Click said after the session. "The garbage collection's definitely gotten better, the JIT's (Just in Time compiler) gotten better, the runtime's gotten better, a lot of things have gotten better," Click said.
Scripting languages are ideal for smaller programs but Java is the choice for larger programs, he said. "As your program grows in size, the lack of strong typing basically kills your ability to handle a very large program and so you don't find the million-line Perl program," he said. One-million-line Java programs are plentiful, Click said. Strong typing refers to the capability of knowing the type of memory objects.
Also during the symposium Wednesday, Neal Ford, senior application architect at ThoughtWorks, spoke of DSLs (domain-specific languages) as a way to simplify programming. A DSL is a next step after a framework like Spring, he said. DSLs allow developers to express ideas in a concise way while objects, aspects, and generics become building blocks for a DSL, he said.
"You build a framework like Spring to handle aspects, but even something like Spring is getting complicated now," he said.
Language workbenches, such as Microsoft's Software Factories or JetBrains's MPS (Meta-Programming System), represent external DSLs, he said.