Small performance tweak (primarily for start time) #3276
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Small performance tweak (primarily for start time) to avoid duplicated styles injections (once skipping CSS mixins and variables and second time with them)
Besides it allows to skip some CPU cycles (observably, RegExps take a bit more time, so it worth it), it also doesn't duplicate styles in 2 stylesheets inserted at different stages, especially good for Non-Chromium browsers, since allows to emulate less in case of Shadow DOM polyfill.
I do not really care about Shady DOM, so since I've encountered 2 tests failing with this patch under Shady DOM changes only affect Shadow DOM (either native or polyfilled, both are fine).
P.S. I'm experiencing significant performance penalty with multiple CSS mixins/vars in elements that have dozens of instances on page (especially under non-Chromium, this is one of results of exploration how to optimize something in styling system without crashing everything.