Why is i-- faster than i++ in loops?

JavascriptPerformanceAlgorithmOptimization

Javascript Problem Overview


> Possible Duplicate:
> JavaScript - Are loops really faster in reverse…?

I don't know if this question is valid in other languages or not, but I'm asking this specifically for JavaScript.

I see in some articles and questions that the fastest loop in JavaScript is something like:

for(var i = array.length; i--; )

Also in Sublime Text 2, when you try to write a loop, it suggests:

for (var i = Things.length - 1; i >= 0; i--) {
	Things[i]
};

I want to know, why is i-- faster than i++ in loops?

Javascript Solutions


Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAfshin MehrabaniView Question on Stackoverflow