Repository navigation
perf: despawn and playermap optimization - #877
chocodev11 wants to merge 5 commits into
Conversation
Flint test reportImplemented tests: 820 total, 772 passed, 48 failed Regressions
Newly implemented blocks/itemsNone. Workflow run · failure links to flint-viz are in the test log |
|
This pull request has conflicts with the base branch "master". Please resolve those so we can test out your changes. |
…wn_persistent_mob
|
Conflicts have been resolved! 🎉 |
| let mut order = Vec::clone(order); | ||
| order.retain(|indexed| !Arc::ptr_eq(indexed, slot)); | ||
| order |
There was a problem hiding this comment.
really stupid question, but you copy every element first and when removed these elements afterwards.
Is it not better to create a new vec with the old length but empty and when copy when loop by hand and add all correct elements into the new vec.
because for me, you loop first to copy all elements and when loop again to remove elements. So why my tactic you only should loop once, or do I see something wrong here?
Also about how many elements are we talking here? which get's removed or added?
There was a problem hiding this comment.
uhmm so i can change to your tatic but i shouldnt gain the performance much (<1% ig), abt the amount of element, it roughly the max-players value
There was a problem hiding this comment.
I know, but this is a simple thing to do and I like to improve things like this, because they improve and don't cost much rewrite work
Type of change
Description
iter_playersno longer locks, allocates, hashes or clones an arc per player, which made the nearest-player scan about 3x faster. (claude do the benchmark)How this was tested
Screenshots / logs
Checklist
Classes / commands modified:
Additional notes