Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Extremely slow rendering of colors #6353

Open
fredcallaway opened this issue Apr 7, 2024 · 2 comments
Open

[Bug]: Extremely slow rendering of colors #6353

fredcallaway opened this issue Apr 7, 2024 · 2 comments
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior.

Comments

@fredcallaway
Copy link

PsychoPy Version

2024.1.0

What OS are your PsychoPy running on?

macOS Intel

Bug Description

My task is an interactive game with about 100 elements on the screen (see image below). I'm using a gaze contingent display, so I call flip on every frame. I'm getting about 12 frames per second on average, which makes animations look terrible, produces noticeable lag between input and response, and leads to frequent missed click events.

I did some profiling and almost all the run time is spent in Color.__deepcopy__. Maybe I'm naive, but it seems like rendering a red circle shouldn't take so much CPU time.

Is there anything to be done here? Or should I assume that psychopy isn't meant to handle complex graphics and switch to pure pygame?

I appreciate any help anyone can provide here!

image

Expected Behaviour

Frame rates of at least 30Hz, ideally 60.

Steps to Reproduce

I can try to produce a minimal example if there's actually interest in working on this.

Additional context

No response

@fredcallaway fredcallaway added the 🐞 bug Issue describes a bug (crash or error) or undefined behavior. label Apr 7, 2024
@fredcallaway
Copy link
Author

Here's a quick fix that's working for me. In Color.render I check if self.contrast is 1 and bypass the copy step if so.

# Transform contrast to match rgb
contrast = self.contrast
if contrast == 1:
    return getattr(self, space)
    
contrast = np.reshape(contrast, (-1, 1))
contrast = np.hstack((contrast, contrast, contrast))
...

@TEParsons
Copy link
Contributor

@cmacmillan noticed the same thing and I've spoken to them previously about solutions, there's some discussion in this PR: #5790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior.
Projects
None yet
Development

No branches or pull requests

2 participants