[Eeglablist] Huge speedup in runica

Curtis Bingham cnbingham at gmail.com
Thu Jun 17 17:33:40 PDT 2021


During the conference on Tuesday someone wrote: 

 

“Just something that I found in the runica() script: if you comment out "drawnow" on line 1047, there is a dramatic speed-up of the script. This has something to do with the GUI and nothing with ICA itself, so I think it could easily be optimized.”

Arnaud created an issue in github for runica.m.

 

Replacing ‘drawnow’ with ‘drawnow limitrate’ cuts the processing time in my trials from ~400 seconds to 55-64 seconds. I’m processing 19 channel data, 10 minutes in length, no ERPs. I’m sure the gains will be even more significant with additional channels and especially with multiple data sets within a STUDY. 

 

The drawnow function is called in 6 different places in repeating loops. It is designed to allow gui refresh and callbacks to be executed when running within the gui.  Commenting it out removes all interactivity with Matlab or EEGLab while running an extended ICA decomposition.  

 

If you append ‘limitrate’ to the command, it only refreshes the gui every 20fps instead of every time the function is called. If less than 50ms have elapsed since the last call it tosses graphics updates but executes callbacks. Very good interactivity is retained, as is the ability to interrupt the ICA decomposition. 

 

Merely commenting out the drawnow doesn’t materially change the execution time on my data. However, as a matter of good coding practice this should be turned off altogether if not running inside a GUI. 

 

I recommend that, at the very least, runica.m be modified to replace ‘drawnow’ with ‘drawnow limitrate’. 

 

Curtis

 

 

 

 




More information about the eeglablist mailing list