mapbox / mapbox/mapbox-gl-js

Reduce the number of ArrayBuffer objects created/used

Open
#5,168 1 comment 5 reactions 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

The analysis in https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-323087798 points out that we create a rather large number of ArrayBuffers. This seems to amplify an underlying memory leak in Safari, but also more generally, it's possible that we could achieve some performance gains by reducing the total number of ArrayBuffer objects we create. We could do this by:
- using an object pool
- restructuring buffers to be shared across style layers

The former is a much less invasive change, but it's also limited: the minimum number of ArrayBuffers would still be proportional to the number of active style layers. In the latter case, that would not be the case.

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 with the analysis in issue #4695, especially comment 323087798, to understand where the ArrayBuffers are created and how Safari's memory behavior is affected. Compare the object-pool and shared-buffer approaches described here; done means reducing ArrayBuffer creation without losing the expected map behavior and demonstrating the performance or memory benefit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.