sgibb / MALDIquant

Quantitative Analysis of Mass Spectrometry Data
https://strimmerlab.github.io/software/maldiquant/
60 stars 25 forks source link

Reduced memory requirement for filterPeaks #71

Closed paoloinglese closed 2 years ago

paoloinglese commented 2 years ago

Hi, I've modified the filterPeaks function to use less memory. The current implementation uses a binary matrix for the peaks occurrence. I've defined a list with row, columns only, which should require less memory, if the occurrence is sparse. I've passed the tests on MacOS.

paoloinglese commented 2 years ago

Improved the performances:

using the dataset fiedler2009subset

default:

Unit: milliseconds
                                    expr     min       lq     mean   median       uq      max neval
 filterPeaks(peaks, minFrequency = 0.05) 1.61042 1.631214 1.651639 1.647169 1.661566 1.928226   100

new ver:

Unit: microseconds
                                    expr     min       lq     mean   median      uq      max neval
 filterPeaks(peaks, minFrequency = 0.05) 722.474 728.0705 802.5767 735.6795 816.511 4070.322   100
codecov[bot] commented 2 years ago

Codecov Report

Merging #71 (11764c1) into master (b1ca2ff) will decrease coverage by 0.81%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
- Coverage   88.44%   87.63%   -0.82%     
==========================================
  Files          81       81              
  Lines        1411     1439      +28     
==========================================
+ Hits         1248     1261      +13     
- Misses        163      178      +15     
Impacted Files Coverage Δ
R/as.matrix-functions.R 100.00% <100.00%> (ø)
R/filterPeaks-functions.R 79.45% <100.00%> (-20.55%) :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 b1ca2ff...11764c1. Read the comment docs.

sgibb commented 2 years ago

That looks really promising! Great enhancement! Unfortunately my time is very limited currently. I will give it a throughout review the next days!

sgibb commented 2 years ago

Closed by #72