Skip to content

TTFW: Blink.Window() just takes too long to load #288

@rafaqz

Description

@rafaqz

So I use blink for a lot of things, and it's useful. But its tedious.

using Blink takes over 5 seconds on my laptop:

2022-01-20-134131_1920x1080_scrot

Mostly this is spent in AssetRegistry.jl (the large red section). I'm not sure why this takes so long.

Second, the first time Blink.Window() takes over 11 seconds:

2022-01-20-135156_1920x1080_scrot

A lot of compilation (cant we precompile some of this for a generic Window call?) and the large middle chunk in Mux.jl and Parser, wherever that is.

Loading vscode only takes 2 seconds, and it's built on Electron too...

How do we reduce this to a reasonable amount?

Edit:

Package load time

It seems at least partly this is caused by the strange relationships of Blink.jl and WebIO.jl: If Blink depends on WebIO.jl, why is there code for blink in a Requires.jl block in WebIO.jl? This breaks precompilation.

Reorganising the requires block in WebIO.jl gets the load time of Blink.jl down to 1 second!

Blink.Window

A large fraction of the load time is parsing in s JSON.Parser.parse. For a generic window, surely we can do this work up-front during precompilation?

Another large fraction of the work is type inference, probably due to all the untyped objects. This also means that precompile(Window, ()) is not very successful. Precompiling the component methods that Window() ends up calling in HTTP.jl/Mux.jl may be able to reduce this. But more type stability should also help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions