Skip to content

Commit

Permalink
Reduce worker count to speed up M2 (#73)
Browse files Browse the repository at this point in the history
There were too many workers on macOS. 8 workers is too much on the M2,
now running 4 and getting much better performance.
  • Loading branch information
erincatto authored Dec 10, 2023
1 parent d484c6c commit 6e7b835
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Sample::Sample(const Settings& settings)
{
b2Vec2 gravity = {0.0f, -10.0f};

uint32_t maxThreads = B2_MIN(8, enki::GetNumHardwareThreads());
uint32_t maxThreads = B2_MIN(8, enki::GetNumHardwareThreads() / 2);
printf("Box2D worker count = %d\n", maxThreads);
m_scheduler.Initialize(maxThreads);
m_taskCount = 0;

Expand Down

0 comments on commit 6e7b835

Please sign in to comment.