compomics / compomics-utilities

Open source Java library for computational proteomics
http://compomics.github.io/projects/compomics-utilities.html
30 stars 17 forks source link

Performance of Chromatogram panel #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From discussion at PSI meeting.

On a repaint event the following is called:

GraphicsPanel.paint();
GraphicsPanel.drawFilledPolygon();

This method appears to generate a peak, represented as a "filledPolygon()", for 
all data in the raw data. The Java filledPolygon is quite a slow method and 
thus this process can be incredibly slow when repeated 1,000's of times.

To counter this, perhaps the drawFilledPolygon() method should cache if the 
data/viewport has not changed to reduce the cost of repaint events.

Original issue reported on code.google.com by detritus.c on 17 Apr 2014 at 9:33

GoogleCodeExporter commented 9 years ago
I'm cannot seem to be able to reproduce this issue. If you double click the 
utilities jar file to run the utilities demo there is a chromatogram demo in 
the third tab, and there is very little lag when repainting.

It could be that this chromatogram is small compared to the ones you are using. 
Could you send me one of your chromatograms as a text file of x, y coordinates? 
Then I will try to reproduce the issue.

Original comment by harald.b...@gmail.com on 19 Apr 2014 at 9:05

GoogleCodeExporter commented 9 years ago
I have attached a replacement Chromatogram and I can reproduce the issue in the 
demo with it. This takes 30+ seconds to change tabs with, so very noticeable.

Original comment by detritus.c on 23 Apr 2014 at 4:15

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, issue reproduced. As the problem only seems to occur when there are more 
than a certain number of peaks, the solution was to add two new chromatogram 
modes: profile mode or centroid mode, where the new default is centroid mode.

The difference between the two is that while profile mode used the slow 
drawFilledPolygon method to draw lines connecting the peaks, centroid mode only 
draws the peaks themselves. This is much faster and in in chromatograms with 
lots of peaks the initial display looks more or less the same. The changes are 
only visible when the user starts zooming.

I've also added a new method to the ChromatogramPanel class (setProfileMode) 
that makes it easy to switch between the two modes.

The new version will be available in the Maven repository by the end of the 
week.

Original comment by harald.b...@gmail.com on 23 Apr 2014 at 9:44

GoogleCodeExporter commented 9 years ago
From our first tests with this, the performance is vastly improved.

Thank you!

Original comment by detritus.c on 29 Apr 2014 at 1:18