Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Float32 to Uint16 for encoding colors in buffers #10587

Open
mourner opened this issue Apr 16, 2021 · 1 comment
Open

Switch from Float32 to Uint16 for encoding colors in buffers #10587

mourner opened this issue Apr 16, 2021 · 1 comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@mourner
Copy link
Member

mourner commented Apr 16, 2021

Currently we use a pair of Float32 values to represent a color value in WebGL buffers:

type: 'Float32',
components: type === 'color' ? 2 : 1,

Using a pair of Uint16 instead should be enough precision while cutting the amount of data necessary to represent data-driven color properties in half, which might be a nice low hanging fruit to optimize performance in styles that extensively use data-driven colors (such as Mapbox core styles).

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Apr 16, 2021
@mourner mourner changed the title Switch from Float32 to Uint16 for encoding colors in buffers Apr 16, 2021
@Beilinson
Copy link

Any news on this ticket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
2 participants