Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Modularization of map layer types #13276

Closed
pozdnyakov opened this issue Nov 5, 2018 · 5 comments
Closed

Modularization of map layer types #13276

pozdnyakov opened this issue Nov 5, 2018 · 5 comments
Assignees
Labels
Core The cross-platform C++ core, aka mbgl refactor

Comments

@pozdnyakov
Copy link
Contributor

pozdnyakov commented Nov 5, 2018

This issue includes re-grouping and refactoring the map layers code and updating the build configuration, so that for each layer type we can enable or disable the related code at compile time. As a result, we will be able to exclude any layer type from the delivered binaries.

@pozdnyakov
Copy link
Contributor Author

Layer modules can be disabled/enabled at the platform/ level.

@chloekraw
Copy link
Contributor

@pozdnyakov @tmpsantos - I'm drafting a note for Snap here and I'd like to show a table of how much they can save on binary size by disabling a layer by referencing https://tmpsantos.com.br/binary/.

Quick question, let's say Snap were able to disable symbol layer -- would the size savings be limited to the 26.0kB from the style, or would the compiler flag also disable related functions like SymbolLayout, SymbolBucket, and SymbolInstance, resulting in additional size savings?

@pozdnyakov
Copy link
Contributor Author

@chloekraw exculding a layer module from the layer manager removes all the related code from the binary including both style (style::<Layer type>Layer, style::<Layer type>LayerImpl, ..) and render (<Layer type>Bucket, <Layer type>Layout, Render<Layer type>Layer, so on..) parts + platform bindings.

For disabled symbol layer the size savings should be much more than 26 kB.

@chloekraw
Copy link
Contributor

Thank you @pozdnyakov. Two quick points of clarification:

  1. In this doc, expressions and annotations are included in the size estimation table. I see that we have a compile flag for annotations (LayerManager::annotationsEnabled); is there one for expressions? Is it possible for a developer to disable expressions today?

  2. Could you confirm whether LayerManager is accessible on the platform side so that developers using our releases can also take advantage of size savings? My current impression is no -- only developers building Mapbox from source can add/remove layers from LayerManager and set the annotations compile flag.

@pozdnyakov
Copy link
Contributor Author

  1. Unfortunately no, expressions code is spread in our code base. It'll require a lot of work to encapsulate it in a module.
  2. LayerManager is configurable at build time, e.g. with MBGL_LAYER_.. compile-time flags. It is necessary to build from source to take its advantages.
    The possible way to enable distribution size management in run time is to build every layer module into a separate dynamic library, then instead of a single core library we will have a core library + layer plugins, that could be excluded from the package.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl refactor
Projects
None yet
Development

No branches or pull requests

3 participants