Home / Companies / Semgrep / Blog / Post Details
Content Deep Dive

Making Semgrep rip: How Ripgrep inspired us to shave hours off (some) scans

Blog post from Semgrep

Post Details
Company
Date Published
Author
Ben Kettle
Word Count
2,895
Company Posts That Month
10
Language
English
Hacker News Points
-
Post removed?
No
Summary

Semgrep's file targeting step, crucial for filtering files against ignore patterns before scanning, experienced significant inefficiencies, taking hours in some cases due to millions of regex calls for large repositories. By replacing most regex lookups with string comparisons and building a hash table index, Semgrep drastically improved performance, reducing a customer's repo scan time from 7.5 hours to under 2 minutes. These changes, available in Semgrep 1.162.0, reduced the 99th percentile scan duration from nearly an hour to under 12 minutes. Semgrep supports various ignore patterns, including those from .gitignore and .semgrepignore, allowing customization of scan findings and optimizing scan times further by focusing on relevant files. The implementation of optimized matching strategies, inspired by Ripgrep, enabled most patterns to be evaluated with simple string comparisons, significantly decreasing regex calls. The improvements led to substantial speedups across Semgrep's customer base, especially for the most time-consuming scans, enhancing the overall efficiency and reliability of Semgrep's scanning process.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Kubernetes 4 2,148 318 105 +9%
Observability 3 4,166 768 194 +22%
OpenTelemetry 1 967 177 57 +2%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.