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

perf: replace stream with for loop when retrieving facets. #4780

Merged
merged 3 commits into from Jun 20, 2021

Conversation

pollend
Copy link
Member

@pollend pollend commented Jun 20, 2021

I believe streams are quite a bit more expensive compared to a simple for loop. chunk generation is evaluated quite heavily so I think this should help a little with chunk generation. probably not substantial though but the logic change is pretty simple overall. by no means is this a good comparison since both runs are in a unique world with different scheduling for each thread so the profiling does not really quanitfy any significant change from either run. chunk generation is going to be harder to reproduce overall unless we want to write a JMH benchmark that better verifies this.

before:
image

after:
image

@skaldarnar
Copy link
Member

I started the VisualVM CPU profiler when creating a plain Core Gameplay world. During the whole process I did not move.

  • start with render distance "far"
  • wait for all chunks to be generated (no more active chunk gen threads)
  • increase render distance to "ultra"
  • wait for all chunks to be generated (no more active chunk gen threads)

With that setup it does not seem to make a difference, but my system is running way faster than yours it seems...

Before
image

After
image

@skaldarnar
Copy link
Member

Did another run with JS

  • LOD chunks: 0
  • render distance: far
  • create world (seed hsNAlXJetn4d8a4Z) and wait for all chunks to be generated

Before
image

After
image

@skaldarnar
Copy link
Member

Did another run with JS

  • LOD chunks: 10
  • render distance: far
  • create world (seed hsNAlXJetn4d8a4Z) and wait for all chunks to be generated

Before
image

After
image

@pollend
Copy link
Member Author

pollend commented Jun 20, 2021

I have a ryzen processor so I have a lot of threads I could throw at the problem. wonder why we only allocate 4 @skaldarnar or we could do some kind of parallel execution within each facet :?

@pollend pollend merged commit 65c5d39 into develop Jun 20, 2021
@pollend pollend deleted the perf/improve-performance-getFacet branch June 20, 2021 19:56
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.

None yet

2 participants