Send diffStyles output to Worker#updateLayers, rather than complete style layers info
Open
Nobody has claimed this yet.
performance :zap:
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Followup to https://github.com/mapbox/mapbox-gl-js/pull/3621
By adding code analogous to Style#setState on the Worker, we could reduce (sometimes significantly, I think) the amount of data that needs to be sent to workers for an updateLayers operation.
In fact, a nice way to do this would be:
- Pare
Style's responsibilities down exclusively to state management (maybe renaming it toStyleStateor some such). This means extracting stuff likeSourceCachemanagement, Worker updates, etc. to a higher level parent module, instead emitting state change events that the parent object could use to do the SourceCache/Worker/etc. updating stuff. - Replace
StyleLayerIndexwithStyleState(adding an option allowing the worker to disable validation), and pull out the part ofsetStatethat actually applies the diff operations into a separate method. - In
StyleState, emit the diffStyles operations that were applied as part of the payload for the state change events, so thatupdateWorkerscan just send that instead of the serialized style layers.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading pull request #3621 and tracing Style#setState, StyleLayerIndex, updateWorkers, and updateLayers. Compare the current worker payload with the proposed diffStyles operations; done means workers receive the diff instead of complete serialized style-layer information while preserving layer updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100