Back to the main page.

Bug 1520 - ft_checkdata is very slow on component data

Status CLOSED FIXED
Reported 2012-06-12 16:06:00 +0200
Modified 2014-01-29 13:28:32 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Eelke Spaak
URL:
Tags:
Depends on:
Blocks:
See also:

Eelke Spaak - 2012-06-12 16:06:02 +0200

When plotting five ft_topoplotIC's sequentially, this takes about 14 seconds. This is mainly due to ft_checkdata being called both by ft_topoplotTFR (which is called by ft_topoplotIC to do the actual plotting), and by ft_prepare_layout (which is called by ft_topoplotTFR with a data argument, even if you pre-specify a layout structure). Commenting out the ft_checkdata calls in ft_prepare_layout and ft_topoplotTFR reduces the runtime by about 4 seconds, so probably 2s of latency are introduced by ft_checkdata when plotting component topographies. Importantly, removing the ft_checkdata calls does not result in any different output or more errors or so. This should be optimized. (I would not mind trying to do this, but I have no idea what ft_checkdata is actually doing in its 1935 lines of matlab wisdom.)


Eelke Spaak - 2012-06-12 16:06:44 +0200

(PS: Possibly ft_checkdata could use an overhaul for other data types as well. But component seems to be most problematic.)


Eelke Spaak - 2012-06-12 16:07:42 +0200

(In reply to comment #0) > reduces the runtime by about 4 seconds I of course mean "reduces the runtime *TO* about 4 seconds" (or: "by 10 seconds").


Eelke Spaak - 2012-06-13 14:05:54 +0200

@FT meeting: inventorize what ft_sens_* ft_chan_* and their helper functions should be doing and how they should be related. Then compare to how it actually is, and resolve the discrepancy.


Eelke Spaak - 2012-12-12 10:16:22 +0100

I just committed a change to ft_defaults where the bulk of the function body is only executed once every session. This reduces the execution time of ft_topoplotIC by about 200ms, and should speed up other functions as well.


Eelke Spaak - 2012-12-12 10:58:22 +0100

Another commit: ft_prepare_layout now only calls ft_checkdata in case data is actually used. Speedup ~500ms.


Eelke Spaak - 2012-12-12 15:00:44 +0100

It turns out that ft_sens_* and ft_chan_* are already a lot faster than earlier. For the record: 'sens' refers to an entire sensor description structure (i.e. a grad or elec), while 'chan' refers to a particular channel (which can be axial gradiometer, reference magnetometer, EEG channel, that sort of stuff). Closing this bug, but filing a new one about performance in general: bug 1886.


Eelke Spaak - 2014-01-29 13:28:32 +0100

changing lots of bugs from resolved to closed.