-
Notifications
You must be signed in to change notification settings - Fork 204
perf(gamemessage): Replace GameMessageArgument linked lists with vectors #2700
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,6 @@ class GameMessageArgument : public MemoryPoolObject | |
| { | ||
| MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(GameMessageArgument, "GameMessageArgument") | ||
| public: | ||
| GameMessageArgument* m_next; ///< The next argument | ||
| GameMessageArgumentType m_data; ///< The data storage of an argument | ||
| GameMessageArgumentDataType m_type; ///< The type of the argument. | ||
| }; | ||
|
|
@@ -637,7 +636,6 @@ class GameMessage : public MemoryPoolObject | |
| GameMessage *prev() { return m_prev; } ///< Return prev message in the stream | ||
|
|
||
| Type getType() const { return m_type; } ///< Return the message type | ||
| UnsignedByte getArgumentCount() const { return m_argCount; } ///< Return the number of arguments for this msg | ||
|
|
||
| const char *getCommandAsString() const; ///< returns a string representation of the command type. | ||
| static const char *getCommandTypeAsString(GameMessage::Type t); | ||
|
|
@@ -660,8 +658,8 @@ class GameMessage : public MemoryPoolObject | |
|
|
||
| /** | ||
| * Return the given argument union. | ||
| * @todo This should be a more list-like interface. Very inefficient. | ||
| */ | ||
| UnsignedByte getArgumentCount() const { return static_cast<UnsignedByte>(m_argList.size()); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bot is complaining about the 255 limit assert. Fix:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bot is hallucinating, this is the exact behaviour as it was before (UnsignedByte counter that would wrap back to 0), but with actual debug crash if it actually can happen. Using min logic would potentially mask the issue more when it happens, the current logic would keep it more obvious. The current functionality is broken in any case, as we don't handle the more than 255 arguments case at all. Also do we want to keep retail compatibility? I think this would cause mismatch with retail as the message args would end up differing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no message that has anywhere near 255 arguments. So it is impossible to break retail compat with this. I think the complaint is valid. If the value wraps, it better not lose visibility to all arguments, but simply be unable to use the excess ones beyond 255. The assert will highlight that too many arguments are added.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that no existing message type can approach 255 arguments, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| const GameMessageArgumentType *getArgument( Int argIndex ) const; | ||
| GameMessageArgumentDataType getArgumentDataType( Int argIndex ) const; | ||
|
|
||
|
|
@@ -681,10 +679,7 @@ class GameMessage : public MemoryPoolObject | |
|
|
||
| Int m_playerIndex; ///< The Player who issued the command | ||
|
|
||
| /// @todo If a GameMessage needs more than 255 arguments, it needs to be split up into multiple GameMessage's. | ||
| UnsignedByte m_argCount; ///< The number of arguments of this message | ||
|
|
||
| GameMessageArgument *m_argList, *m_argTail; ///< This message's arguments | ||
| std::vector<GameMessageArgument*> m_argList; ///< This message's arguments | ||
|
|
||
| /// allocate a new argument, add it to list, return pointer to its data | ||
| GameMessageArgument *allocArg(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.