how greater than/less than works internally
how much performance hit will be there if i compare 5 with 100 vs 5 with 2,147,483,647 (Integer.MAX_VALUE)
5 < 100 and 5 < Integer.MAX_VALUE
I am asking this question because in some code rank= Integer.MAX_VALUE is returned when data is not present and we will discard data even if rank is greater than 100, so will there be some considerably improvement if i return 101 instead of Integer.MAX_VALUE. I am getting file of millions of records and i have to do this comparison for every record.
On all 32- and 64-bit hardware architectures that I am familiar with the two comparisons would take exactly the same amount of time.
The way to improve performance is by focusing on the number of comparisons that you make (and, more generally, the amount of work your algorithm has to carry out).