Skip to content

Conversation

@ragoune
Copy link
Contributor

@ragoune ragoune commented Mar 17, 2025

We can remove the entitiesNames map in the World structure. This relational map was used to keep track of the entities names per their EntityId.

The EntityId being a uint64, we can simply generate this using a hash value of the EntityName instead of a random: it simplifies the code, reduces the time spent to generate the random id (the hash seems faster than the rand).
Moreover, removing this relational map hugely reduces the memory usage (from 57996246 to 41214216 Bytes/operation in the benchmark BenchmarkCreateEntityVolt).

It was already the case but not strictly documented: the entity name MUST be unique, otherwise we would only rewrite on the same entity.

@codecov
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 76.66667% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
world.go 76.66% 5 Missing and 2 partials ⚠️
Files with missing lines Coverage Δ
world.go 71.33% <76.66%> (-5.33%) ⬇️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ragoune ragoune merged commit 28eb5ac into master Mar 17, 2025
3 of 4 checks passed
@ragoune ragoune deleted the feat/improve-performances branch March 17, 2025 12:22
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.

2 participants