-
-
Notifications
You must be signed in to change notification settings - Fork 675
Perf: Add global caching and other optimizations #1467
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
base: master
Are you sure you want to change the base?
Conversation
- Implemented thread-safe GlobalCache (LRU) for expensive operations. - Added zero-allocation GlobalKey struct to eliminate string concatenation. - Optimized GetCallInfo with per-package AST node caching. - Cached GoVersion using sync.Once. - Implemented entropy pre-filtering and more efficient comment parsing. - Migrated multiple rules (G101, G111, G114, G306) to use centralized caching. - Verified ~8.6x speedup on CockroachDB (37s -> 4.3s) and ~600MB memory reduction.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1467 +/- ##
==========================================
+ Coverage 68.49% 69.19% +0.69%
==========================================
Files 75 83 +8
Lines 4384 6516 +2132
==========================================
+ Hits 3003 4509 +1506
- Misses 1233 1785 +552
- Partials 148 222 +74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Now also fixes #1240 |
|
I also tried and abandoned some other optimization methods that didn't produce results. Maybe someone in the future is more successful in trying these.
|
|
Here's another data point. Kubernetes scan time:
|
|
Would you prefer if I split this into smaller changes? I just made this branch to investigate where the performance bottlenecks were and which ones were reasonably easy to tackle without going completely crazy. In the end this combination of changes seemed to offer a really nice balance of performance boosts without resorting to anything too weird. |
Performance Impact (Benchmarked on CockroachDB)