Skip to content

Improve performance of the map for large surveys - #3870

Open
andreia-ferreira wants to merge 2 commits into
masterfrom
andreia/3866/optimize-map-clustering
Open

Improve performance of the map for large surveys#3870
andreia-ferreira wants to merge 2 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 67.99%. Comparing base (c61510d) to head (16aeee9).

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.70%   67.99%   +0.28%     
- Complexity     1859     1877      +18     
============================================
  Files           411      411              
  Lines         10857    10870      +13     
  Branches       1425     1425              
============================================
+ Hits           7351     7391      +40     
+ Misses         2767     2737      -30     
- Partials        739      742       +3     
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 3 files with indirect coverage changes

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

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.

1 participant