Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[chemclipse-dev] Performance problem of AbstractScanMSD.addIon(boolean, IIon)

In method org.eclipse.chemclipse.msd.model.core.AbstractScanMSD.addIon(boolean, IIon),
there is a loop to check duplicated ion:
for(IIon actualIon : ionsList) {
if(checkIon(ion, actualIon)) {
/*
* Check whether the intensity should be added or only the
* higher intensity should be taken.<br/> Replace the abundance
* only, if the abundance is higher than the older one otherwise
* do nothing
*/
if(addIntensity) {
addIntensities(actualIon, ion);
addNew = false;
break;
} else {
if(ion.getAbundance() >= actualIon.getAbundance()) {
addHigherIntensity(actualIon, ion);
addNew = false;
break;
} else {
addNew = false;
break;
}
}
}
}

This loop will break if checkIon() return true. If I have a large amounts of ions to add to scan, it will cost more time in addIon() method.
The ions to be added are increasing generally, so there might be two aspects to improve this procedure.
1) iterate the ionsList reversely. It will meet the same ion earlierly and break earlierly.
2) if the ion to be added is greater the last ion in ionsList, it is no necessary to loop the ionsList to check duplication.

How about it?

Best regards,

Trig

Back to the top