ShadowCss.shimCssText slow after RC6 update
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
The above line takes a few hundred milliseconds to run. See the attached JS profile:

If we include images as data urls in the css output, the performance is destroyed. The application startup might take anything from 5 to 30 seconds when having approx. 50 kB css included as component styles.

Expected/desired behavior
Shouldn’t take that long, RC5 did not have this issue.
Reproduction of the problem
Sample webpack configuration snippet
module: {
loaders: [
{test: /\.ts$/, exclude: [/\.spec\.ts$/, /node_modules/], loader: 'ts'},
{test: /\.css$/, loader: 'raw'},
{test: /\.html$/, loader: 'raw'},
{test: /\.scss$/, loader: 'exports-loader?module.exports.toString()!css!postcss-loader!sass'},
{test: /\.(png|jpg|gif)$/, exclude: /favicon\//, loader: 'url-loader?limit=8096&name=' + config.imageAssetPath }
],
// ...
}
Component
@Component({
styles: [require('./my.component.scss')]
})
class MyComponent {}
.scss (output is 70kB when minified)
$weather-map: (
n600: "\e600",
n500: "\e601",
n440: "\e602",
/* ~60 rows */
)
@each $name, $code in $weather-map {
.weather-#{$name}:before {
background-image: url('../../../images/weather-icons/#{$name}.png');
}
}
Please tell us about your environment:
- Angular version: 2.0.0-rc.6
- Browser: all
- Language: TypeScript 2.0.2
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:15 (6 by maintainers)
Top Results From Across the Web
angular: slow startup after upgrading to rc6 - Stack Overflow
Problem was solved: In rc6 a regular expression triggered so called "back-tracking" and thereby caused high cpu-load.
Read more >UNPKG - @angular/compiler
n *\n * Typically, a template runs both the creation block and the update block on initialization and\n * subsequent runs only execute...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tobias74 @dcg thanks for the analysis.
we’ll do our best to include a fix in the next release as we understand it is important for dev mode.
@dcg thanks for the feedback - the fix has been merged