The Artima Developer Community
Sponsored Link

Angle Brackets and Curly Braces
Josh Bloch on the Semantic Gap
by Bill Venners
September 19, 2009
Summary
At the JVM Languages Summit, Josh Bloch expressed his concern about what he called the "semantic gap" between the source code we write and its performance at runtime: As performance improves, our ability to predict the performance consequences of our source code degrades.

Advertisement

As you write source code, you make choices on how to design and implement the task at hand. Although you may believe that "premature optimization is the root of all evil," as Donald Knuth once put it, you might sometimes allow performance concerns guide your choices. The reason is that not all early optimization is premature. Sometimes it is prudent. The trick is to be able to tell the difference between premature and prudent optimization.

Whether you are optimizing prematurely or prudently, you need a performance model: a conceptual model of how the different algorithm and implementation choices you are facing will perform at runtime. At this year's JVM Languages Summit, Josh Bloch lamented that as performance has increased, our ability to create accurate performance models has decreased, and that it is just going to get worse. Here's what he said:

The chip, the JVM, the libraries, and the language--all are growing more complex, which makes the performance model less and less transparent. Beyond a certain level, performance quality and performance-model quality are inversely related. To get increased performance, you complicate the system, resulting in reduced predictability and repeatability (i.e., decreased performance-model quality). I don't see any easy solution, I think it's just something we'll have to live with. The major coping strategy is measuring the performance, attempting to improve it, and remeasuring.

Cliff Click expressed the same sentiment this way:

Premature optimization is the root of all evil is more true today than ever before.

On the other hand, Bloch also said, "It helps to know the potential trouble spots." He called a workshop that brainstormed a list of some "performance gotchas" that exist today, which were documented on this wiki page:

http://wiki.jvmlangsummit.com/MindTheSemanticGap

What are your thoughts on the semantic gap?

Talk Back!

Have an opinion? Readers have already posted 33 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Bill Venners adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Bill Venners is president of Artima, Inc., publisher of Artima Developer (www.artima.com). He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Active in the Jini Community since its inception, Bill led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill is also the lead developer and designer of ScalaTest, an open source testing tool for Scala and Java developers, and coauthor with Martin Odersky and Lex Spoon of the book, Programming in Scala.

This weblog entry is Copyright © 2009 Bill Venners. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us