circleci / rollcage

A Clojure client for Rollbar
Eclipse Public License 1.0
50 stars 28 forks source link

Reduce memory consumption under heavy usage. #50

Closed conormcd closed 3 years ago

conormcd commented 3 years ago

If we are reporting many similar exceptions we will call circleci.rollcage.core/build-trace many times for exceptions with identical or very similar stack traces. By memoizing circleci.rollcage.core/rollbar-frame we can avoid some expensive re-work on the most common stack frames and thereby reduce the memory consumption (and I/O profile) of this library.

Rough testing suggests that this change can yield a >20x reduction in memory consumption when many similar exceptions are thrown.

codecov[bot] commented 3 years ago

Codecov Report

Merging #50 (e14deb3) into master (dc0df39) will decrease coverage by 4.73%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
- Coverage   96.94%   92.20%   -4.74%     
==========================================
  Files           4        4              
  Lines         229      231       +2     
  Branches        4        5       +1     
==========================================
- Hits          222      213       -9     
- Misses          3       13      +10     
- Partials        4        5       +1     
Impacted Files Coverage Δ
src/circleci/rollcage/core.clj 91.41% <100.00%> (-5.53%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dc0df39...e14deb3. Read the comment docs.

conormcd commented 3 years ago

I'm also open to implementing this as some sort of extension/hook to prevent us from having to bring in an additional dependency.