• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

postcss / postcss-selector-parser / 738
95%

Build:
DEFAULT BRANCH: master
Ran 19 Apr 2021 10:11AM UTC
Jobs 3
Files 30
Run time 15s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
738

push

travis-ci

web-flow
pref: rework unesc for a 63+% performance boost (#239)

* In profiling postcss I found that a significant amount of time was being
spent in [`unesc`](https://github.com/postcss/postcss-selector-parser/commits/master/src/util/unesc.js), this was due to the expensive regex checks that were
being performed on the fly for every selector in the codebase which looked to be performing quite poorly inside of modern node and v8.

![image](https://user-images.githubusercontent.com/883126/114136698-fdd98a80-98bf-11eb-8068-ace4f6f2274d.png)

----

As an experiment and based on some prior experience with this class of slowdown I migrated the implementation to one that performs a scan through the string instead of running a regex replace. By testing this on my local application I instantly saw the work from this function go from > 900 ms to ~100ms.

![image](https://user-images.githubusercontent.com/883126/114136734-0c27a680-98c0-11eb-82ab-f0c9529fd32d.png)

This implementation passes all of the existing test cases and aims to mirror the prior implementation's implementation details :)

-----

Based on my application I am seeing the major wins come from purgecss dropping my total application build by multiple seconds! 🔥

* Expand unesc handling to correctly handle spec edgecase for lone
surrogates and out of bound codepoint values.

753 of 854 branches covered (88.17%)

38 of 38 new or added lines in 1 file covered. (100.0%)

1312 of 1375 relevant lines covered (95.42%)

768.03 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
100.0
src/util/unesc.js
Jobs
ID Job ID Ran Files Coverage
1 738.1 19 Apr 2021 10:11AM UTC 0
95.42
Travis Job 738.1
2 738.2 19 Apr 2021 10:11AM UTC 0
95.42
Travis Job 738.2
3 738.3 19 Apr 2021 10:11AM UTC 0
95.42
Travis Job 738.3
Source Files on build 738
  • Tree
  • List 30
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Travis Build #738
  • 1012e3a5 on github
  • Prev Build on master (#724)
  • Next Build on master (#741)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc