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

Pre-allocate memory #9

Closed
sgibb opened this issue Sep 4, 2017 · 1 comment
Closed

Pre-allocate memory #9

sgibb opened this issue Sep 4, 2017 · 1 comment

Comments

@sgibb
Copy link
Contributor

sgibb commented Sep 4, 2017

As I already described in #4.

Here are some examples that could be improved by pre-allocating memory:

d <- list()
for (i in 1:ncol(I)){
d[[i]] <- createMassSpectrum(mz,I[,i])
}

MALDIrppa/R/MSlist2.R

Lines 3 to 6 in 39adb98

d <- list()
for (i in 1:ncol(I)){
d[[i]] <- createMassPeaks(mz,I[,i])
}

MALDIrppa/R/MSlist.R

Lines 3 to 6 in 39adb98

d <- list()
for (i in 1:ncol(I)){
d[[i]] <- createMassSpectrum(mz,I[,i])
}

Already addressed by #4 :

peaks2 <- list()
for (i in 1:length(x)){
t_int <- intensity(x[[i]])
t_mas <- mass(x[[i]])
mini <- which(t_int < min)
t_int <- t_int[-mini]
t_mas <- t_mas[-mini]
peaks2[[i]] <- createMassPeaks(mass=t_mas,intensity=t_int)
}

@Japal
Copy link
Owner

Japal commented Sep 16, 2017

Done

@Japal Japal closed this as completed Sep 16, 2017
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

No branches or pull requests

2 participants