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

Threads seem to run at reduced speed in Pyxel (proportional to FPS) #563

Open
dskill opened this issue Sep 5, 2024 · 2 comments
Open

Threads seem to run at reduced speed in Pyxel (proportional to FPS) #563

dskill opened this issue Sep 5, 2024 · 2 comments

Comments

@dskill
Copy link

dskill commented Sep 5, 2024

First off thank you for this amazing game making tool.

I'd like to use it to with some educational LLM/audio generation game experiments, but I noticed that the FPS of pyxel seems to have a very direct impact on how long it takes to execute calls in a thread.

For example, I'd like to run

response = openai_client.chat.completions.create(
            model="gpt-4o",
            messages=messages,
            max_tokens=30,
            temperature=0.7)

in a thread, so that I can get an LLM result back without blocking pyxel's playback. However, if I do that, I have noticed that the time it takes to get a result is very slow (and roughly proportional to the fps I have pyxel set to).

Do you have any advice on how to run threads at full speed in pyxel? Thx!

@dskill dskill changed the title Using Pyxel with other libraries and threads is slow Threads seem to run at reduced speed in Pyxel (proportional to FPS) Sep 5, 2024
@kitao
Copy link
Owner

kitao commented Jan 7, 2025

How about the result with the latest Pyxel? Python GIL related code is changed.

@dskill
Copy link
Author

dskill commented Jan 7, 2025

I just tried with version: 2.2.10, and at first i thought the problem was resolved. It seemed to be faster than in my previous tests. However when i set the pyxel framerate to 2 as a brute force test, I never got a response back from open AI. So I believe the FPS is still throttling async communications.

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

No branches or pull requests

2 participants