mapbox / mapbox/mapbox-gl-js

Send diffStyles output to Worker#updateLayers, rather than complete style layers info

Open
#3,650 0 comments 1 reaction 0 assignees View on GitHub

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 to StyleState or some such). This means extracting stuff like SourceCache management, 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 StyleLayerIndex with StyleState (adding an option allowing the worker to disable validation), and pull out the part of setState that 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 that updateWorkers can just send that instead of the serialized style layers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.