c# - Is shifting bits faster than multiplying and dividing in Java? .NET? -


Left bits and much more than the correct transfer, multiplication and division functions, possibly more, than the CPU if you have 2 Using the power of However, it can reduce the clarity of code for some readers and some algorithms. Is there really a necessary bit-transfer to perform, or can I expect to notice and adapt the compiler or VM case (especially, when the power-word of 2 is literal)? I mainly java and I am interested in NET behavior, but welcome insights into other language implementations.

Most compilers today to switch operations or multiply by power-to-to Will do more than. While optimizing, many compilers can multiply or split with compiled time, even if it does not have the power of 2. Often many times a series of multiplication or split poly can be decomposed and adds, and if the series of operations gets faster, the compiler will use it in comparison to the multiplication or division.

For a continuous partition, the compiler can often multiply the operation by 'magic number' and change after a change. This can be a major clock-cycle saver because multiplication is often very much in comparison to the operation of a division.

There is a lot of information on this topic, which comes out quite well on the partner website: < Li> li>

Anyway, all this compiler Allows to take care of the tedious details of micro-optimization.

It has been for many years that you are making your own changes.

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -