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

Use ThreadWorkPool instead of thread_process_array in NavMap [3.x] #60366

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

adamscott
Copy link
Member

@adamscott adamscott commented Apr 19, 2022

3.x PR of #60359

Finally, porting PR #60359 to 3.x was easier than anticipated. All because core/templates/thread_work_pool.{h, cpp} was easily ported (only required some copy and paste).

Note. This PR seems to work, but I do not know if I broke some rules, as core/templates didn't already exist.

As a benchmark, I used the minimal reproduction project of issue #56838 made by thoced.
NavigationAgentTest.zip

Godot 3.x [master] (using thread_process_array), first minute, VSYNC disabled (Windows 10)
Capture d’écran 2022-04-19 001728

Godot 3.x [master] (using ThreadWorkPool), first minute, VSYNC disabled (Windows 10)
Capture d’écran 2022-04-19 002131

As the addition of the new template, this pretty much confirms that a simple cherry-pick of #60359 wouldn't work for 3.x

Along with PR #60359, fixes #56838. But this needs testing.

@akien-mga
Copy link
Member

Please add thread_work_pool.h in core/os/ with the other Thread related functionality in 3.x, instead of a templates. The core structure changed in master but for 3.x we should keep the pre-existing structure.

Copy link
Member

@RandomShaper RandomShaper left a comment

Choose a reason for hiding this comment

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

As discussed on IRC, the engine should be improved in regards to thread pooling (namely, removing threaded_array_processor() and revising thread pooling so that pools are managed in a more automatic and rational way, depending on platforms. etc.).

We've agreed to let this in anyway, since it's already an improvement given the current state of things, while the deeper discussion comes.

@adamscott
Copy link
Member Author

Please add thread_work_pool.h in core/os/ with the other Thread related functionality in 3.x, instead of a templates. The core structure changed in master but for 3.x we should keep the pre-existing structure.

I moved the files as asked! Thanks!

@adamscott
Copy link
Member Author

Backported merged PR #60528 made by @bruvzg to init step_work_pool only when needed.

@akien-mga akien-mga merged commit ba7881b into godotengine:3.x Apr 26, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants