Skip to content
Commit 74071038 authored by Jan Sebechlebsky's avatar Jan Sebechlebsky Committed by Ján Sebechlebský
Browse files

Change contentEquals implementation to operate in O(n) time.

Calling other.get(key) does binary search in the "other" instance to look up the key, but this is not necessary, since if the two instances are equal, they will contain same keys with same values in exact same order.

The cl also does some other minor changes:
* avoid unnecessary method calls / bounds check in contentEquals.
* avoid unnecessary method calls / bounds check / autoboxing in
  contentHashCode.
It's possible that some of these would be done by AOT / JIT optimizations, but they generally tend to have some cost in Java.

Test: atest SparseArrayTest
Bug: 260964842

Change-Id: I060ea39e85056a86e986a0fe61d153c18c234f4b
parent e87964fa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment