Closed Bug 1510664 Opened 6 years ago Closed 3 years ago

Performance Warning: HashMap can be replaced with SparseArray

Categories

(GeckoView :: General, enhancement, P5)

Unspecified
Android
enhancement

Tracking

(firefox93 fixed)

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: fluffyemily, Assigned: elizabbennet)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

For maps where the keys are of type integer, it's typically more efficient to use the Android SparseArray API. This check identifies scenarios where you might want to consider using SparseArray instead of HashMap for better performance.  

This is particularly useful when the value types are primitives like ints, where you can use SparseIntArray and avoid auto-boxing the values from int to Integer.  

If you need to construct a HashMap because you need to call an API outside of your control which requires a Map, you can suppress this warning using for example the @SuppressLint annotation.

Affected Classes:

GeckoSurfaceTexure
Keywords: good-first-bug
OS: Unspecified → Android
Priority: -- → P5
Product: Firefox for Android → GeckoView

This PR replaces HashMap with SparseArray from the Android API to
improve memory efficiency and performance.

Assignee: nobody → elizabbennet
Status: NEW → ASSIGNED
Attachment #9234145 - Attachment description: Bug 1510664 - Replace `HashMap` with `SparseArray` in class GeckoSurfaceTexture → Bug 1510664 - Replace `HashMap` with `SparseArray`
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d86e37de9470
Replace `HashMap` with `SparseArray` r=agi
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: