Skip to content

OSD tab is relatively slow to load (most time spent in font load/parse) #4494

Open
@DavidAnson

Description

@DavidAnson

Describe the bug

  1. Load the OSD tab using virtual connection on a slowish computer (Chromebook)

Profiling shows about 1.7s of total time is spent handling the font download, about 0.9s of which is self time in toDataUrl:

$.get(`./resources/osd/${fontver}/${$font.data("font-file")}.mcm`, function (data) {

It looks like the code parses the font file characters and then calls pushChar for all of them and that function ends by calling draw for every character which force-renders them (and also caches them):

FONT.draw(FONT.data.characters.length - 1);

I can't easily stub this out to try, but it seems to me that the artificial call to draw from pushChar is unnecessary and could be removed which would wait to render each character until it was needed (many of which won't be needed at all) and would still be cached.

To Reproduce

See above

Expected behavior

Faster, please :)

Configurator version

11.0.0 (1809bb8)

Flight controller configuration

Add any other context about the problem that you think might be relevant here

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions