Skip ignore comment checks for files with no ignore comments#730
Skip ignore comment checks for files with no ignore comments#730marvinhagemeister wants to merge 1 commit intocsstools:mainfrom
Conversation
Previously we'd cast every rule to a string and then check if an ignore comment is present. That constant casting and repeatedly calling the regex costs a lot of time. We can avoid that work if we know that the input source doesn't contain any ignore comments at all.
|
@marvinhagemeister Thank you this! @Antonio-Laguna Maybe we should reconsider removing this feature? Given that we are doing breaking changes for I've also looked over this feature and I don't see a way to make it not a performance issue. Thoughts? |
|
Dropping support for ignore comments all together works for me 👍 |
|
Another optimization is reusing saving the |
Because regex literals don't change during runtime (like I'd certainly rather see it behind a plugin for the few people who want it and are okay with the performance hit. |
|
see : #737 The check for the comment is impossible to make really fast. |
|
@marvinhagemeister Thank you again for starting this. We have merged #737 as a fix for the underlying issue and added you as a co-author because you did all the hard work to pinpoint the issue! We will ship this as soon as possible |
|
@romainmenke Awesome sounds good to me! Thanks again for taking a look 👍 |
|
@marvinhagemeister This was just released. |
Previously we'd cast every rule to a string and then check if an ignore comment is present. That constant casting and repeatedly calling the regex costs a lot of time. We can avoid that work if we know that the input source doesn't contain any ignore comments at all.
This speeds up postcss compilation time in one of my projects by about 4.6s. In that project there are no css files with postcss comments anywhere.
Before: