Java Faster Than C ?

S

Stefan Ram

Rishi Boparai said:
Can Java be faster than 'C'? Incredible but true.

There seems to have been a new benchmark execution
that shows Jet 6.4 to be about as fast as GCC, while
VMs also achieved impressive results, but still are
about half as fast on the average:

»SUN's JDK has some weak points that can be seen in the
fannkuch and himeno benchmarks. Without these two
benchmarks the hotspot server compiler would be almost
competitive with GCC. Nevertheless JDK 6U6 has gained
quite a bit performance in comparison to JDK 6U2.«

http://www.stefankrause.net/wp/?p=9
 
R

Roedy Green

There seems to have been a new benchmark execution
that shows Jet 6.4 to be about as fast as GCC, while
VMs also achieved impressive results, but still are
about half as fast on the average:

When you benchmark different code, the results have a lot to do with
the skill of the person who tweaks the benchmark. I used to work for
Univac fine tuning benchmarks. Tiny tweaks would let us skunk the
competition.

For your sort of benchmark, you need to let a representative of each
compiler tweak the code.
 
M

Mike Schilling

Roedy said:
When you benchmark different code, the results have a lot to do with
the skill of the person who tweaks the benchmark. I used to work for
Univac fine tuning benchmarks. Tiny tweaks would let us skunk the
competition.

For your sort of benchmark, you need to let a representative of each
compiler tweak the code.

This can be overdone. There's the well-known SQL benchmark where the
winning vendor tweaked their optimizer to recognize the query text and
return the answer immediately. (They got much slower when extra whitespace
was added.)
 
R

Roedy Green

This can be overdone. There's the well-known SQL benchmark where the
winning vendor tweaked their optimizer to recognize the query text and
return the answer immediately. (They got much slower when extra whitespace
was added.)

One of the strategies for winning benchmarks is to provide the
benchmark. If you have control over that, you can bias it to the
party you want to win.

The catch is, it is rare when those composing the benchmark don't have
bias.

Knuth has frightened people off EVER tweaking code. People don't
realise today how tiny changes to code can give you huge boosts, or
looked at the other way, how tiny errors in coding have huge time
penalties.
 
A

Arved Sandstrom

Roedy Green said:
One of the strategies for winning benchmarks is to provide the
benchmark. If you have control over that, you can bias it to the
party you want to win.

The catch is, it is rare when those composing the benchmark don't have
bias.

Knuth has frightened people off EVER tweaking code. People don't
realise today how tiny changes to code can give you huge boosts, or
looked at the other way, how tiny errors in coding have huge time
penalties.
--

Well, to be honest, how many programmers have ever heard of Knuth, let alone
know what he's done, and let alone read his books? I became aware of the guy
early in my career because I used TeX/LaTeX (itself quite rare), and later I
bought the 3-volume set of TAoCP (and how many developers have done that?).
Hell, I've even read parts of those books. :)

I bring that up because it's unlikely, having never heard of Knuth, that
most coders know the full quote: "We should forget about small efficiencies,
say about 97% of the time: premature optimization is the root of all evil.
Yet we should not pass up our opportunities in that critical 3%." In other
words, go ahead and do it when the decision is informed; don't do it when
it's not. So many programmers likely do have this vague idea that they
should not tweak code at all, not until the last moment anyhow (when it's
entirely possible that a tweak now becomes a hack). I've myself encountered
the mindset often enough.

I realize that you aren't suggesting that Knuth himself pooh-poohed all
optimization.

AHS
 
P

Patricia Shanahan

Roedy Green wrote:
....
Knuth has frightened people off EVER tweaking code. People don't
realise today how tiny changes to code can give you huge boosts, or
looked at the other way, how tiny errors in coding have huge time
penalties.

Huh? Knuth's greatest work contains pseudo-code implementations in a
sort of assembly language for a machine that never existed. Practical
use of an algorithm from "The Art of Computer Programming" has
to begin with reimplementation in a different language.

Patricia
 
M

Mike Schilling

Lew said:
People who take slogans such as "premature optimization (or money)
is
the root of all evil" too literally are at a disadvantage in life
generally. We all have a responsibility to take such slogans as
overly broad and to know they're almost certainly misquoted. (It's
the *love of* money that's the root of all evil, not money itself.)

As stated, it's almost a tautology. Optimization that's a good idea
isn't premature.
 
A

Arne Vajhøj

Arved said:
Well, to be honest, how many programmers have ever heard of Knuth, let alone
know what he's done, and let alone read his books? I became aware of the guy
early in my career because I used TeX/LaTeX (itself quite rare), and later I
bought the 3-volume set of TAoCP (and how many developers have done that?).
Hell, I've even read parts of those books. :)

I bring that up because it's unlikely, having never heard of Knuth, that
most coders know the full quote: "We should forget about small efficiencies,
say about 97% of the time: premature optimization is the root of all evil.
Yet we should not pass up our opportunities in that critical 3%." In other
words, go ahead and do it when the decision is informed; don't do it when
it's not. So many programmers likely do have this vague idea that they
should not tweak code at all, not until the last moment anyhow (when it's
entirely possible that a tweak now becomes a hack). I've myself encountered
the mindset often enough.

The programmers with a formal IT education should have heard about
Knuth.

Arne
 
A

Arne Vajhøj

Roedy said:
Knuth has frightened people off EVER tweaking code. People don't
realise today how tiny changes to code can give you huge boosts, or
looked at the other way, how tiny errors in coding have huge time
penalties.

When the word tweaking applies it is usually the wrong form
of optimization.

All the "is doing it with this language feature versus doing
it with this language feature" optimization (which is what I
consider tweaking) is usually a waste of time.

What matters is algorithms (which BTW was what Knuth was
writing about) and architecture.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top