forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent requesting a new trade window with each "trade" (opentib…
…iabr#2700) Identified Problems: • Item Loop Performance: The loop in the ProtocolGame::sendShop function performed key-value store (KV) access operations for each NPC item during every iteration. This was highly inefficient for NPCs with many items, such as "The Lootmonger," which has 1380 items. • Lack of Database Caching: Currently, our database does not implement caching for query results. This leads to redundant database accesses, particularly noticeable when commands like "trade" are used repeatedly, significantly increasing CPU usage and processing time. Implemented Solutions: • Optimization of the Item Loop: Necessary initialization has been moved outside the loop in the ProtocolGame::sendShop method. This reduces overhead by avoiding unnecessary repetitive database accesses. • Removal of Unnecessary Map: Removed an extraneous map in npc.hpp and simplified the use of the shop player cache. These changes aim to streamline interactions and reduce the computational load, especially during frequent trade requests with item-rich NPCs like "The Lootmonger." Additional optimizations have been made to enhance overall system performance.
- Loading branch information
Showing
9 changed files
with
73 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters