Skip to content

[optimization] optimize initialization of arc.js #199

Closed
@jellegerbrandy

Description

@jellegerbrandy

On first page load, there is a delay initializing arc.js. The delay seems a bit onpredicably, but is sometimes considerable (several seconds).

@jellegerbrandy wrote (in issue #194):

more lowhaning fruit: this line https://github.com/daostack/alchemy/blob/dev/src/index.tsx#L18 halts execution until arcjs is initialized. This can take some time, bc the init process also waits for establishing a websocket connection [<- I think] (whcih we are not using), which can take some time.

Solutions here are (a) do not await the initilization (which takes some tricky refactoring) and (b) make the initialization ligher (or the websocket optional) (I don't know about the latter, bc I have not looked yet at what the initilization actually is supposed to do)

@dkent600 replied:

@jellegerbrandy Regarding the call toInitializeArcJs, you should be using the filter configuration setting to speed it up. See here: https://daostack.github.io/arc.js/Configuration/#optimizedcontractloading.

I don't think it is using websockets at all.

What I think we shoudl look at is:

  1. Add the filter, as @dkent600 suggests
  2. Check out if web3 does not try to open a websocket anyway (my hunch is based on the fact that sometimes the app hands on loading at this point in devtools -> network:
    image
  3. Check out if we can refactor the loading code and not halt execution while waiting for initializeArcjs.

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