Skip to content

Add cache for map icons - #3884

Open
andreia-ferreira wants to merge 4 commits into
masterfrom
andreia/3866/map-bitmap-icon-size
Open

Add cache for map icons#3884
andreia-ferreira wants to merge 4 commits into
masterfrom
andreia/3866/map-bitmap-icon-size

Conversation

@andreia-ferreira

Copy link
Copy Markdown
Collaborator

Towards #3866

Every icon was rebuilt from scratch (cluster icons and regular marker icons) on panning and zooming the map. On large surveys this could cause the map performance to drop significantly and also lead to OOM crashes due to memory pressure.

This PR introduces a cache for both clusters and marker icons.

The impact of these changes can be seen in the heap dump comparison of before/after.
Before:
Screenshot From 2026-08-14 10-55-40

After:
image

@shobhitagarwal1612 PTAL?

@andreia-ferreira andreia-ferreira changed the title Andreia/3866/map bitmap icon size Add cache for map icons Aug 14, 2026
}

private val clusterIcons =
object : LruCache<String, BitmapDescriptor>(1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we increase the default to 16 as well?

@shobhitagarwal1612 shobhitagarwal1612 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements! 👏 👏 👏

Left a minor comment for your consideration. Please feel free to ignore if you disagree with the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants