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

ENH: Improve Color.render performance for the case when contrast is 1 #5027

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

lkeegan
Copy link
Contributor

@lkeegan lkeegan commented Jul 21, 2022

This makes draw() faster, e.g. here are snakeviz profiles for 100x Circle.draw() calls:

Without this PR:

image

With this PR:

image

Code used for above profiles:

from psychopy.visual.window import Window
from psychopy.visual.circle import Circle
import cProfile

window = Window(fullscr=True, units="height")
circle = Circle(window, radius=0.1, lineColor="black", fillColor="red")

with cProfile.Profile() as pr:
    for i in range(100):
        circle.draw()
        window.flip()
pr.dump_stats("profile.prof")

@TEParsons TEParsons self-requested a review July 21, 2022 10:18
Copy link
Contributor

@TEParsons TEParsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout, I can see why this would speed things up!

@peircej peircej merged commit 14bdb82 into psychopy:release Jul 21, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants