Skip to content

Conversation

@jprzimba
Copy link
Collaborator

Creature removal is now much faster as we avoid unnecessarily iterating over large sets.
The code is more organized and easier to understand, with clear helper functions.
The solution is scalable and can easily handle larger limits of known creatures if needed. The optimized code above significantly improves the performance and maintainability of the known creatures cache system in OTServ.
It resolves issues related to unnecessary iteration and inefficient data structures, ensuring faster and more reliable operation.

Creature removal is now much faster as we avoid unnecessarily iterating over large sets.
The code is more organized and easier to understand, with clear helper functions.
The solution is scalable and can easily handle larger limits of known creatures if needed.
The optimized code above significantly improves the performance and maintainability of the known creatures cache system in OTServ. It resolves issues related to unnecessary iteration and inefficient data structures, ensuring faster and more reliable operation.
@jprzimba jprzimba added the enhancement New feature or request label Mar 11, 2025
@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Apr 11, 2025
@sonarqubecloud
Copy link

@github-actions github-actions bot removed the Stale label Apr 16, 2025
++it;
// We need to protect party players from removing
const auto &checkPlayer = creature->getPlayer();
if (!checkPlayer || (checkPlayer->getParty() != player->getParty() && !canSee(creature))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aqui é necessário fazer uma checagem a mais

if ((checkPlayer && (checkPlayer->getParty() != player->getParty() && !canSee(creature))) || (!checkPlayer && !canSee(creature))) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jprzimba jprzimba changed the title [performance] optimized the checkCreatureAsKnown function perf: optimized the checkCreatureAsKnown function Apr 16, 2025
@jprzimba jprzimba merged commit 7ad236d into main Apr 19, 2025
27 checks passed
@jprzimba jprzimba deleted the optimize-known-creatures branch April 20, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants