mapbox / mapbox/mapbox-gl-js

Shader minification

Open
#9,390 6 comments 0 reactions 1 assignee View on GitHub

@karimnaaji is already working on this.

Since Jun 11, 2020.

feature :green_apple: performance :zap:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Changes to the shaders seems to be rather impactful on the library size. To minimize that we can try to make use of https://www.npmjs.com/package/glsl-minifier which also benefits from a forked version of https://github.com/aras-p/glsl-optimizer.

glsl-optimizer has a few advantages such as dead code removal, algebraic simplifications (increase of instruction merging), constant propagation, constant folding and inlining or loop unfolding.

If we manage to introduce both of these we would most likely benefit from both library size reduction and potential run-time GPU optimization.

We would have to find a way to flag our shader injection symbols to not be optimized, as we have shader code variants based on data driven styling.

cc @arindam1993

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.