klabhub / neurostim

Design and run visual neuroscience experiments using Matlab and the Psychophysics Toolbox.
MIT License
5 stars 3 forks source link

Slow frame-loop #67

Closed adammorrissirrommada closed 7 years ago

adammorrissirrommada commented 7 years ago

The recent change to use preget and postget for all parameters has approximately doubled the time taken to get around the frame loop. I can no longer run behaviorDemo at anything other than 60Hz. Each call to getvalue() takes approximately 0.01ms on my machine, but it's called zillions of times.

Compare profile figures for commit 1ad7dbd with the one that preceded it.

@bartkrekelberg, can you see any way around this?

adammorrissirrommada commented 7 years ago

I saved about 15% of the getvalue() time by having o.setListener default to false rather than true (i.e. it's switched on temporarily only for '@' functions)... but I guess that's not really a workable solution to the larger problem. I won't bother committing it.

bartkrekelberg commented 7 years ago

I rewrote some of the code and committed to the master branch. Timing seems much better, but I cannot test at 120Hz here.

Try tools/profileParameters.m for an objective comparison of access times. (together with framedrops of course).

adammorrissirrommada commented 7 years ago

This is a massive improvement Bart. Good job. That said, it looks like I will probably still get frame drops at 120Hz (I also can't test it here, though can in the lab later). My frame loop (up to waiting for flip) is taking close to 8ms on this machine (which is identical to my lab PC). It was around 10ms on my home PC, so I think we still have a general issue with sluggishness.

To be clear, I get these numbers by:

1) Turning profile on in cic 2) Running behaviorDemo with dot duration set to a very large number. 3) Letting it run for a minute or so. 4 Looking at the difference between the frame interval and the value in the "fliptime" panel.

bartkrekelberg commented 7 years ago

I am still working to squeeze some more performance out of the code. I have a few ideas for improvement... More soon.

On Mon, Mar 27, 2017 at 12:56 AM Adam Morris notifications@github.com wrote:

This is a massive improvement Bart. Good job. That said, it looks like I will probably still get frame drops at 120Hz (I also can't test it here, though can in the lab later). My frame loop (up to waiting for flip) is taking close to 8ms on this machine (which is identical to my lab PC). It was around 10ms on my home PC, so I think we still have a general issue with sluggishness.

To be clear, I get these numbers by:

  1. Turning profile on in cic
  2. Running behaviorDemo with dot duration set to a very large number.
  3. Letting it run for a minute or so. 4 Looking at the difference between the frame interval and the value in the "fliptime" panel.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/klabhub/neurostim-ptb/issues/67#issuecomment-289323462, or mute the thread https://github.com/notifications/unsubscribe-auth/ALbI05k7zToEqbW7RS3F8AatqyDuZ4X-ks5rpu0sgaJpZM4Mnhbp .