---

developerWorks: Eye on Performance: Micro Performance Benchmarking

“Although no Usenet discussion groups are dedicated purely to
Java performance, there are many discussions about performance
tuning and optimization. A good portion of these discussions rely
on results obtained from micro performance benchmarks, so we’re
also going to talk about some of the benefits and pitfalls of
microbenchmarking in this month’s column.

“One particular question caught our eye: which operation is
faster, i++ or ++i? We have seen this question asked in various
forms in every forum that we cover. As simple as the question it
appears, there seems to be no definitive answer.

“First, in case you are unaware of the difference, ++i uses the
pre-increment operator, whereas i++ uses the post-increment
operator. While both increment the variable i, the pre-increment
operator returns the value i had before the increment operation,
and the post-increment operator returns the value i has after the
increment operation…”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis