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

GlyphManager continually re-requests ranges with missing glyphs #8027

Closed
ChrisLoer opened this issue Mar 12, 2019 · 1 comment · Fixed by #9375
Closed

GlyphManager continually re-requests ranges with missing glyphs #8027

ChrisLoer opened this issue Mar 12, 2019 · 1 comment · Fixed by #9375
Assignees
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@ChrisLoer
Copy link
Contributor

Consider the format expression demo:

map.setLayoutProperty(layer, 'text-field', ['format',
  ['get', 'name_en'], { 'font-scale': 1.2 },
  '\n', {},
  ['get', 'name'], {
    'font-scale': 0.8,
    'text-font': ['literal', [ 'DIN Offc Pro Italic', 'Arial Unicode MS Regular' ]]
  }]);

\n isn't in 0-255.pbf for this fontstack, which is fine, because it doesn't need to draw anything, and the actual line breaking is handled separately in the shaping. But whenever a tile gets reloaded, getGlyphs won't find the glyph here:

let glyph = entry.glyphs[id];
if (glyph !== undefined) {
callback(null, {stack, id, glyph});
return;
}

So it will re-request the entire range. This probably isn't a huge deal because the data should be cached, and it's not super-expensive to reload the PBF... but it's wasteful and it looks ugly in the network monitor (it grabbed my attention because if you have the cache disabled it looks like a major source of data traffic in maps that reload tiles frequently).

I don't think gl-native has the same issue since its glyph manager checks for already-loaded ranges instead of glyphs:

https://github.com/mapbox/mapbox-gl-native/blob/096dea16e31c6e0d91eba0cab1ab2efc5d6ae853/src/mbgl/text/glyph_manager.cpp#L45-L52

cc @ryanhamley @asheemmamoowala

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Mar 12, 2019
@skol-pro
Copy link

Not fixed as of today ?

Since I added some \n in my points title, I get hundreds of calls per seconds to /0-255.pbf.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants