Skip to content

perf(scanner,test): speed up language tests (lazy DB, short-circuit, smaller fixtures)#5390

Open
gheyderov wants to merge 2 commits intoossf:mainfrom
gheyderov:test/speedup-language-scanner
Open

perf(scanner,test): speed up language tests (lazy DB, short-circuit, smaller fixtures)#5390
gheyderov wants to merge 2 commits intoossf:mainfrom
gheyderov:test/speedup-language-scanner

Conversation

@gheyderov
Copy link
Copy Markdown

What’s in this PR

  • Lazy CVE DB: Initialize CVEDB only when binary checkers are used (language-only scans don’t create a DB).
  • Language short-circuit: If the filename is a known language fixture (e.g., pom.xml, package-lock.json, PKG-INFO), skip the expensive file-type subprocess checks and call parse(...) directly.
  • Smaller fixtures: Shrink test/language_data/fail_pom.xml and fail-package-lock.json to minimal valid samples; behaviour unchanged (these are none_found tests).

Before vs After (on my machine)

  • test_language_package_none_found (fail_pom.xml): 0.18s → 0.13s

Notes

@gheyderov
Copy link
Copy Markdown
Author

Hi 👋, this PR is part of Hacktoberfest.
If it looks good, could you please add the hacktoberfest-accepted label or review it? 🙏
Thanks!

@terriko
Copy link
Copy Markdown
Collaborator

terriko commented Oct 13, 2025

I don't think this PR actually does what your comment above says, but it looks harmless so I've set the tests to run anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: improve performance on our slowest tests

2 participants