Title: Using a getter function brings the CPU usage to over 100% - Production builds / Chrome ONLY · Issue #24614 · angular/angular · GitHub
Open Graph Title: Using a getter function brings the CPU usage to over 100% - Production builds / Chrome ONLY · Issue #24614 · angular/angular
X Title: Using a getter function brings the CPU usage to over 100% - Production builds / Chrome ONLY · Issue #24614 · angular/angular
Description: I'm submitting a... [ x ] Possible bug report [ x ] Performance issue Current behavior Looping over a list of objects import { Component } from '@angular/core'; @Component({ selector: 'home', templateUrl: './home.component.html', }) expo...
Open Graph Description: I'm submitting a... [ x ] Possible bug report [ x ] Performance issue Current behavior Looping over a list of objects import { Component } from '@angular/core'; @Component({ selector: 'home', templ...
X Description: I'm submitting a... [ x ] Possible bug report [ x ] Performance issue Current behavior Looping over a list of objects import { Component } from '@angular/core'; @Component({ selector: &...
Opengraph URL: https://github.com/angular/angular/issues/24614
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using a getter function brings the CPU usage to over 100% - Production builds / Chrome ONLY","articleBody":"## I'm submitting a...\r\n\u003cpre>\u003ccode>\r\n[ x ] Possible bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ x ] Performance issue\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\nLooping over a list of objects\r\n\r\n```typescript\r\nimport { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'home',\r\n templateUrl: './home.component.html',\r\n})\r\nexport class HomeComponent {\r\n get someList() {\r\n return [\r\n {\r\n title: 'foo'\r\n },\r\n {\r\n title: 'bar'\r\n }\r\n ];\r\n }\r\n}\r\n```\r\n\r\n```html\r\n\u003cdiv *ngFor=\"let item of someList\">{{item.title}}\u003c/div>\r\n```\r\n\r\n\r\n\r\n## Expected behavior\r\nIf there is a problem with the above usage, neither the linter nor the compiler caught it.\r\nIf the above usage is alright, then it should not consume lots of CPU cycles freezing the browser.\r\n\r\n\r\n## Minimal reproduction of the problem with instructions\r\n * Copy the above code into a simple project\r\n * ng build --prod\r\n * cd into the dist directory\r\n * serve the directory (ex: python -m SimpleHTTPServer)\r\n * open localhost:port via browser (Chrome)\r\n * check the cpu usage\r\n\r\n## Workaround\r\n\r\n```typescript\r\nimport { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'home',\r\n templateUrl: './home.component.html',\r\n})\r\nexport class HomeComponent {\r\n someList = [\r\n {\r\n title: 'foo'\r\n },\r\n {\r\n title: 'bar'\r\n }\r\n ];\r\n}\r\n```\r\n\r\n```html\r\n\u003cdiv *ngFor=\"let item of someList\">{{item.title}}\u003c/div>\r\n```\r\nIt would have been great if the problem was caught during the build.\r\nSuch errors is particularly hard to debug since the browser freezes and becomes unresponsive.\r\n\r\n## Environment\r\n\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 6.0.8\r\nNode: 9.11.2\r\nOS: darwin x64\r\nAngular: 6.0.5\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... http, language-service, platform-browser\r\n... platform-browser-dynamic, platform-server, router\r\n... service-worker\r\n\r\nPackage Version\r\n------------------------------------------------------------\r\n@angular-devkit/architect 0.6.8\r\n@angular-devkit/build-angular 0.6.8\r\n@angular-devkit/build-ng-packagr 0.6.8\r\n@angular-devkit/build-optimizer 0.6.8\r\n@angular-devkit/core 0.6.8\r\n@angular-devkit/schematics 0.6.8\r\n@angular/cdk 6.2.1\r\n@angular/cli 6.0.8\r\n@angular/flex-layout 6.0.0-beta.16\r\n@angular/material 6.2.1\r\n@angular/pwa 0.6.8\r\n@ngtools/json-schema 1.1.0\r\n@ngtools/webpack 6.0.8\r\n@schematics/angular 0.6.8\r\n@schematics/update 0.6.8\r\nng-packagr 3.0.2\r\nrxjs 6.2.1\r\ntypescript 2.7.2\r\nwebpack 4.8.3\r\n\r\nBrowser:\r\n[x] Chrome - Version 67.0.3396.87 (Official Build) (64-bit)\r\n\u003c/code>\u003c/pre>\r\n","author":{"url":"https://github.com/un33k","@type":"Person","name":"un33k"},"datePublished":"2018-06-21T19:59:45Z","url":"https://github.com/angular/angular/issues/24614"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:16e058d0-38a6-a32a-ba51-09a43e2da9dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 99C8:57C3A:1471E6B:1CBB027:6B045CAA |
| html-safe-nonce | 9fed3abf0140d595c7370730720ab39640b403782946b3a865062593dbda113e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUM4OjU3QzNBOjE0NzFFNkI6MUNCQjAyNzo2QjA0NUNBQSIsInZpc2l0b3JfaWQiOiIxODMyODc4ODUwMTQxNjA5MTMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c755f3379715b31bb41529d9c2fc85558926ba55459cb60b26e992f6a55d070a |
| hovercard-subject-tag | issue:334636165 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/24614/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ebf5c4e8ef674aa87b3c2ce6e40fe674af3d5ab37004e0115aa2384be5ca7ee/angular/angular/issues/24614 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ebf5c4e8ef674aa87b3c2ce6e40fe674af3d5ab37004e0115aa2384be5ca7ee/angular/angular/issues/24614 |
| og:image:alt | I'm submitting a... [ x ] Possible bug report [ x ] Performance issue Current behavior Looping over a list of objects import { Component } from '@angular/core'; @Component({ selector: 'home', templ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | un33k |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width