Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay rule compilation and cache the results #490

Merged
merged 8 commits into from
Oct 7, 2024

Conversation

tstromberg
Copy link
Collaborator

@tstromberg tstromberg commented Oct 6, 2024

This PR moves rule compilation until the last possible moment and caches the result.

This ensures that path typos such as mal scan ./nonexistent return an error instantly instead of compiling the rules first.

Some example performance improvements:

  • mal xyz: 40X faster
  • mal scan ./nonexistent: 25X faster
  • make test: 9X faster

This does not improve the result of mal scan /path/to/malcontent-samples however.

@tstromberg tstromberg requested a review from egibs October 6, 2024 20:06
Copy link
Member

@egibs egibs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. Funnily enough, I was thinking about caching compiled rules yesterday.

@tstromberg tstromberg merged commit 9111c58 into chainguard-dev:main Oct 7, 2024
6 checks passed
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.

2 participants