I am observing a slowdown of code in my frame loop when calling Screen('Flip',...) with the optional 'when' parameter in ptb3+Matlab on Ubuntu. I have attached a minimal test script, testFlip.m, that illustrates the effect.
The test script does very little other than call and time the rand() function before each call to Screen('Flip',...). Execution of rand() is ~5 times slower when Screen('Flip',...) is called with the 'when' parameter (first page in the attached .pdf) compared to when it is called without the 'when' parameter. I have attached a couple of figures which show histograms of rand() execution times (from the attached test script) for the two conditions. I see the same effect for functions other than rand(), including other ptb operations such as Screen('DrawDots',...).
Is this known and expected behaviour or is this a peculiarity of my system?
I'm running psychtoolbox (from NeuroDebian) in Matlab 2016a on a clean install of Ubuntu 16.04.1 LTS, with the lowlatency kernel.
'uname -a' reports:
Linux ns2 4.8.0-53-lowlatency #56~16.04.1-Ubuntu SMP PREEMPT Tue May 16 02:33:53 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
PsychtoolboxVersion reports:
3.0.14 - Flavor: Debian package - psychtoolbox-3 (3.0.14.20170103+git6-g605ff5c.dfsg1-1~nd16.04+1)
The machine has an Intel Core i7-7700 CPU @ 3.60GHz x8, 32Gb RAM and a GeForce GTX980Ti/PCIe/SSE2 video card (running at 60Hz). I'm using the closed source NVIDIA Driver version 381.22.
CPU usage of the MATLAB process is 99-100% when testFlip() is calling Screen('Flip',...) without the 'when' parameter but only 40-50% when it is calling Screen('Flip',...) with the 'when' parameter.
Any thoughts, comments or suggestions would be most welcome.
Rgds,
Shaun
Monash University