-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: improve performance of websocket message processing #66
Conversation
Make the calls to the object type lookups normal attributes to avoid the function calls
WalkthroughIn this update, the primary change involves refactoring how bootstrap model types and sets are accessed and iterated over within the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/uiprotect/data/bootstrap.py (4 hunks)
- src/uiprotect/data/types.py (3 hunks)
- tests/data/test_common.py (1 hunks)
Additional comments not posted (10)
src/uiprotect/data/types.py (6)
112-116
: Class attributes for model sets are now directly accessible, which should improve performance by avoiding method calls.
148-151
: Efficient use of a generator expression inside the tuple constructor.
155-157
: Direct conversion of a tuple to a set is straightforward and efficient.
160-162
: Direct conversion of a tuple to a set is straightforward and efficient.
165-167
: Efficient use of set union to include the event model.
169-170
: Correctly raises an AttributeError to enforce immutability of class attributes.src/uiprotect/data/bootstrap.py (3)
196-197
: Iterates over a set of model types directly, aligning with the PR's goal to improve performance by using attribute access instead of function calls.
233-234
: Iterates over a set of model types directly, aligning with the PR's goal to improve performance by using attribute access instead of function calls.
553-553
: Checks if the model type is in a set that includes both model types and the event model, aligning with the PR's goal to improve performance by using attribute access instead of function calls.tests/data/test_common.py (1)
312-312
: Ensure that the iteration overModelType.bootstrap_models
directly accesses the class attribute as per the PR's objective.
Description of change
Make the calls to the object type lookups normal attributes to avoid the function calls
Summary by CodeRabbit
Refactor
Bug Fixes
Tests
These changes are internal and should not affect the end-user experience directly.