Skip to content

Improve performance of the map for large surveys - #3870

Merged
andreia-ferreira merged 3 commits into
masterfrom
andreia/3866/optimize-map-clustering
Aug 10, 2026
Merged

Improve performance of the map for large surveys#3870
andreia-ferreira merged 3 commits into
masterfrom
andreia/3866/optimize-map-clustering

Conversation

@andreia-ferreira

@andreia-ferreira andreia-ferreira commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Towards #3866

The performance of large surveys while in the home screen map was bad and could lead to OOM crashes. This was because every LOI outline was handed to the google maps sdk as soon as the survey loaded, just marked as invisible.

This PR changes that so clusterable items are added to the cluster manager but not to the map. Their outlines are created only when the clusterer decides to draw them individually, and released again once they're absorbed back into a cluster.
Additionally, the algorithm of the cluster manager was set as NonHierarchicalViewBasedAlgorithm so that only on-screen features are drawn. This is important especially past the CLUSTERING_ZOOM_THRESHOLD, where all polygons would uncluster and render regardless if they were visible or not

Before:

screen-20260804-235913.mp4

After:

Screen_recording_20260805_190515.webm

@shobhitagarwal1612 PTAL?

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.03%. Comparing base (d276ed3) to head (0542182).

Files with missing lines Patch % Lines
...form/android/ui/map/gms/features/FeatureManager.kt 81.25% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3870      +/-   ##
============================================
+ Coverage     67.75%   68.03%   +0.27%     
- Complexity     1865     1883      +18     
============================================
  Files           411      411              
  Lines         10868    10881      +13     
  Branches       1426     1426              
============================================
+ Hits           7364     7403      +39     
+ Misses         2765     2735      -30     
- Partials        739      743       +4     
Files with missing lines Coverage Δ
...orm/android/ui/map/gms/features/MapsItemManager.kt 58.69% <100.00%> (+9.80%) ⬆️
...form/android/ui/map/gms/features/FeatureManager.kt 62.85% <81.25%> (+43.89%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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.

🚀🚀🚀

@andreia-ferreira
andreia-ferreira merged commit 10762a5 into master Aug 10, 2026
19 checks passed
@andreia-ferreira
andreia-ferreira deleted the andreia/3866/optimize-map-clustering branch August 10, 2026 14:03
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