-
Notifications
You must be signed in to change notification settings - Fork 5
Remove inbounds to _is_alive function #520
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
base: main
Are you sure you want to change the base?
Conversation
Click to expand benchmark resultsTime is per entity/N, allocations are totals. Allocations are only shown for current.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
the effect on performance is kind of bad, though I don't think we have better alternatives |
|
By the way, this avoids UB in two cases as far as I can see:
Maybe the second case is being too paranoid, if we want to fix only the first one I think less impactful changes are possible |
|
I think both are not really valid use cases, as the function is not guarenteed to return the correct result. Both cases may produce entities that are not really valid, but are seen as alive due to having the "correct" generation. So maybe it would be sufficient to just enable bounds checks, but not catch that case explicitly? |
|
Yes this is sensible to me...Though enabling bound checking has the same perf degradation than this more or less |
|
Ok, maybe another strategy: we can probably reset the pool without resizing. Will make reset more costly, but we can avoid bounds checks. |
|
yes, though this will work just for the first case, not the second one, though to me it is okay that the second one remains unsafe since it seems really unimportant |
This function was unsafe before and could cause UB since it is called directly from the public
is_alive