Skip to content

Don't eagerly, serialially download fonts. #7343

Closed

Description

@Hoverbear

cc @mbrubeck

I was testing hoverbear.org in Servo and noticed it loaded extremely slow (~17s). @mbrubeck and I did a bit of digging using RUST_LOG=net on the page and noticed that many web requests were being made to the server to download KaTeX fonts, which are fetched lazily in Firefox.

Firefox fetches zero KaTeX related fonts on the frontpage, and only 3 on lcis which has Math on it.

These bits of code are relevant:
1

    pub fn add_web_font(&self, family: Atom, src: Source) {
        let (response_chan, response_port) = channel();
        self.chan.send(Command::AddWebFont(family, src, response_chan)).unwrap();
        response_port.recv().unwrap();
    }

2

fn add_font_face_rules(stylesheet: &Stylesheet, device: &Device, font_cache_task: &FontCacheTask) {
    for font_face in stylesheet.effective_rules(&device).font_face() {
        for source in &font_face.sources {
            font_cache_task.add_web_font(font_face.family.clone(), source.clone());
        }
    }
}

To reproduce:

./mach build --release
RUST_LOG=net ./mach run http://hoverbear.org

Activity

  1. added
    A-content/css
    I-perf-slow
    on Aug 24, 2015
  2. added 4 commits that reference this issue on Sep 10, 2015
    01afcf8
    76f4ae5
    218ba97
    8354f66
  3. added 4 commits that reference this issue on Sep 25, 2015
    696a95b
    18194b5
    623fbd7
    9bb6acd
  4. added a commit that references this issue on Sep 28, 2015
    7933b48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/cssA-networkI-perf-slow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions