Skip to content

Major performance concerns with pace-js #1628

Open
@charliebravodev

Description

@charliebravodev

Issue type

I'm submitting a ... (check one with "x")

  • bug report
  • feature request
  • question about the decisions made in the repository

Issue description

Current behavior:
Its seems that change detection is called way too many times on most pages. With the starter kit, the NbLoginComponent causes method getConfigValue() to be called roughly 350 times in Safari and 230 in Chrome. When the page takes a while to load in Chrome, the counter goes up to 5000+ calls after a few seconds.

When removing pace-js (loading bar at the top), the counter drops down to 20 on both Safari and Chrome, yet acceptable but still a bit high IMO.

Expected behavior:
Considering that getConfigValue() is used twice in the NbLoginComponent template, and also considering that change detection runs twice as more in Angular CLI's dev mode, I would still expect the number of calls to be around 2-6, not ~90 times (350/2/2). I have tried a production build and the number drops (as expected) to roughly half that amount, but still remains too high.

Steps to reproduce:

getConfigValue(key: string): any {
  return getDeepFromObject(this.config, key, null);
}

to

private count: number = 0;

getConfigValue(key: string): any {
  this.count++;
  console.log(this.count);
  return getDeepFromObject(this.config, key, null);
}
  • Start the application and look at the console:
    • Safari 11.1 (12605.1.33.1.3):
      screen shot 2018-04-09 at 17 17 04
    • Chrome 65.0.3325.181 (Official Build) (64-bit)
      screen shot 2018-04-09 at 17 29 04

And without pace-js:

  • Safari:
    screen shot 2018-04-09 at 17 44 34
  • Chrome:
    screen shot 2018-04-09 at 17 43 43

Related code:

Other information:

npm, node, OS, Browser

node v7.1.0
nom v4.6.1

Angular, Nebular

ngx-admin v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions