Speeding up the JavaScript ecosystem - one library at a time
Briefly

Whilst the trend is seemingly to rewrite every JavaScript build tool in other languages such as Rust or Go, the current JavaScript-based tools could be a lot faster. The build pipeline in a typical frontend project is usually composed of many different tools working together.
Saving 4.6s in PostCSS by analyzing its performance revealed that a regex, used internally by a plugin, was causing a significant delay. Such bottlenecks can be identified through profiling and code inspection.
Curiosity lead me down the path of spending some time profiling common JavaScript-based tools to kinda see where all that time was spent. Let's start with PostCSS, a very popular parser and transpiler for anything CSS.
The place where the regex is created is part of a function that checks if a CSS rule or declaration is preceeded by said comment. The rule.toString() call caught my eye pretty quickly.
Read at Marvinh
[
|
]