jvm - Performance: greater / smaller than vs not equal to -


i wonder if there difference in performance between

checking if value greater / smaller another

for(int x = 0; x < y; x++); // y > x 

and

checking if value not equal another

for(int x = 0; x != y; x++); // y > x 

and why?

in addition: if compare zero, there further difference?

it nice if answers consider assebled view on code.

edit: of pointed out difference in performance of course negligible i'm interested in difference on cpu level. operation more complex?

to me it's more question learn / understand technique.

i removed java tag, added accidentally because question meant not based on java, sorry.

you should still clearer, safer , easier understand. these micro-tuning discussions waste of time because

  • they make measurable difference
  • when make difference can change if use different jvm, or processor. i.e. without warning.

note: machine generated can change processor or jvm, looking not helpful in cases, if familiar assembly code.

what much, more important maintainability of software.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -