maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

Asynchronous GeometryTile deletion

Open mwilsnd opened this issue 1 year ago • 5 comments

General performance augmentation. Defers destruction of a GeometryTile's mailbox to a worker thread. These tiles hold OpenGL objects which must be deleted on the correct thread, so those objects are deleted on the render thread.

A number of special concerns around synchronization had to be addressed.

The primary performance problem centers around the mailbox needing to take both mutex locks before it can be properly closed. As this was done on the render thread, it would stall the whole renderer when the map was in motion.

This started in #1928 and has since been moved to this development branch.

mwilsnd avatar Jan 25 '24 16:01 mwilsnd

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5% +79.0Ki  +0.5% +80.0Ki    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2051-compared-to-main.txt

github-actions[bot] avatar Jan 31 '24 22:01 github-actions[bot]

Codecov Report

Attention: Patch coverage is 56.54952% with 136 lines in your changes are missing coverage. Please review.

Project coverage is 58.38%. Comparing base (003c062) to head (937e261).

Files Patch % Lines
src/mbgl/util/thread_pool.cpp 52.72% 2 Missing and 24 partials :warning:
src/mbgl/text/glyph_manager.cpp 47.61% 0 Missing and 22 partials :warning:
src/mbgl/tile/tile_loader_impl.hpp 48.48% 2 Missing and 15 partials :warning:
src/mbgl/renderer/image_manager.cpp 33.33% 0 Missing and 14 partials :warning:
src/mbgl/tile/tile_cache.cpp 50.00% 0 Missing and 14 partials :warning:
src/mbgl/tile/geometry_tile.cpp 50.00% 1 Missing and 6 partials :warning:
src/mbgl/util/thread_pool.hpp 70.83% 0 Missing and 7 partials :warning:
src/mbgl/renderer/render_source.cpp 53.84% 0 Missing and 6 partials :warning:
src/mbgl/renderer/tile_pyramid.cpp 58.33% 0 Missing and 5 partials :warning:
src/mbgl/actor/mailbox.cpp 84.00% 3 Missing and 1 partial :warning:
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2051      +/-   ##
==========================================
- Coverage   58.38%   58.38%   -0.01%     
==========================================
  Files         572      574       +2     
  Lines       28136    28340     +204     
  Branches    11270    11376     +106     
==========================================
+ Hits        16428    16545     +117     
+ Misses       4158     4157       -1     
- Partials     7550     7638      +88     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 31 '24 23:01 codecov[bot]

Bloaty Results 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5%  +741Ki  +0.3%  +104Ki    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2051-compared-to-main.txt

Compared to d38709084a9865fe0bb8300aec70ebf8243b3d43 (legacy)

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +19% +22.2Mi  +401% +23.9Mi    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2051-compared-to-legacy.txt

github-actions[bot] avatar Feb 01 '24 00:02 github-actions[bot]

!benchmark android

mwilsnd avatar Feb 02 '24 16:02 mwilsnd

ok, I think this one is finally ready

TimSylvester avatar Feb 16 '24 17:02 TimSylvester