mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
StaticElement.closest() handed the raw selector string to css-select's is() on every ancestor step, recompiling the same selector N times for an element N levels deep. StaticDocument now caches one compiled matcher per selector (failed compiles cached as rethrowers so bad selectors still return null). Findings are byte-identical across the fixture corpus; scan time drops to ~62% on the fixtures and ~7x faster on deep-DOM pages. Prepared with AI assistance (Cursor agent), directed by @abdulwahabone. Co-authored-by: Cursor <cursoragent@cursor.com>