views:

164

answers:

2

What is the performance of Shift Operation in Java compared to C++

+5  A: 

Generally speaking, if you think you're going to get significant performance differences in primitive operations between different languages, you're sadly mistaken, and if you think you need to re-write your app or part of your app in a different language to get better performance, the time would be better spent looking at your algoritms and data structures.

Paul Tomblin
There is an exception to the advice above: If your code runs slower than your metrics require and careful investigation accompanied by the use of profiling tools leads you to conclude it is due to a limitation of the programming language. This is highly unlikely to happen in your particular case, and as Paul said usually your algorithm will be to blame when it comes to low level operations. However, this is not guaranteed to be the case.
Brian
@Brian: True, but the differences between implementations of the same programming language may be bigger than the differences between different programming languages.
David Thornley
A: 

This seems like an easy question to answer with some profiling tools available in your favorite C++ and Java IDE's.

andand