Major performance concerns with pace-js
- 主要语言
- TypeScript
- 星标
- 25.7k
- 派生
- 7.9k
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Issue type
**I'm submitting a ...** (check one with "x")
* [x] bug report
* [ ] feature request
* [x] 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`](https://github.com/akveo/nebular/blob/c8273da500bfd6315be42be9427fa9e477e83778/src/framework/auth/components/login/login.component.ts) 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:**
- Clone the [starter kit](https://github.com/akveo/ngx-admin/tree/starter-kit) of this repository.
- Create a login component identical to [Nebular's default `NbLoginComponent`](https://github.com/akveo/nebular/blob/c8273da500bfd6315be42be9427fa9e477e83778/src/framework/auth/components/login/login.component.ts).
- Change the following lines:
```
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):

- Chrome 65.0.3325.181 (Official Build) (64-bit)

And without `pace-js`:
- Safari:

- Chrome:

**Related code:**
### Other information:
**npm, node, OS, Browser**
```
node v7.1.0
nom v4.6.1
```
**Angular, Nebular**
```
ngx-admin v2.1.0
```
贡献指南
评估
这个 Issue 还没有评估数据。