Skip to content

SleekPanther/loop-performance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Loop Performance with i++ & ++i

A simple demonstration of testing the runtimes of pre and post increment operators when applies to loops

Theoretically, ++i should be faster as it doesn't need to copy the value, just increment it. i++ fetches i, copies it, increments it & returns the copy. But this doesn't always work. Sometimes the difference (post - pre) calculated is negative, indicating the i++ post incrementing was faster

All times in nanoseconds

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages