-
Notifications
You must be signed in to change notification settings - Fork 4.6k
⚡️ Speed up function get_stream_descriptor
by 7% in PR #44444 (artem1205/airbyte-cdk-protocol-dataclasses-serpyco-rs
)
#44872
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
⚡️ Speed up function get_stream_descriptor
by 7% in PR #44444 (artem1205/airbyte-cdk-protocol-dataclasses-serpyco-rs
)
#44872
Conversation
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
…dk-protocol-dataclasses # Conflicts: # airbyte-cdk/python/poetry.lock
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
…205/airbyte-cdk-protocol-dataclasses-serpyco-rs # Conflicts: # airbyte-cdk/python/airbyte_cdk/sources/connector_state_manager.py # airbyte-cdk/python/unit_tests/sources/file_based/stream/concurrent/test_file_based_concurrent_cursor.py # airbyte-cdk/python/unit_tests/sources/test_abstract_source.py # airbyte-cdk/python/unit_tests/sources/test_connector_state_manager.py
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
[skip ci] Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
Signed-off-by: Artem Inzhyyants <[email protected]>
…em1205/airbyte-cdk-protocol-dataclasses-serpyco-rs`) To optimize the given Python program for better performance, you can minimize redundant accesses and checks, and utilize pattern matching efficiently. Here’s an optimized version. ### Explanation. - The `message.type` and other repeated attribute accesses are cached to local variables to avoid redundant attribute lookups. - The logic and functionality remain the same to ensure the return value is the same as before. - Slight restructuring results in cleaner and more efficient code. This method aims to minimize the overhead of attribute access and logical checks, which can contribute to a faster runtime, especially when this function is called frequently.
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
|
⚡️ This pull request contains optimizations for PR #44444
If you approve this dependent PR, these changes will be merged into the original PR branch
artem1205/airbyte-cdk-protocol-dataclasses-serpyco-rs
.📄
get_stream_descriptor()
inairbyte-cdk/python/airbyte_cdk/utils/message_utils.py
📈 Performance improved by
7%
(0.07x
faster)⏱️ Runtime went down from
13.6 microseconds
to12.8 microseconds
Explanation and details
To optimize the given Python program for better performance, you can minimize redundant accesses and checks, and utilize pattern matching efficiently. Here’s an optimized version.
Explanation.
message.type
and other repeated attribute accesses are cached to local variables to avoid redundant attribute lookups.This method aims to minimize the overhead of attribute access and logical checks, which can contribute to a faster runtime, especially when this function is called frequently.
Correctness verification
The new optimized code was tested for correctness. The results are listed below.
✅ 5 Passed − ⚙️ Existing Unit Tests
(click to show existing tests)
✅ 3 Passed − 🌀 Generated Regression Tests
(click to show generated tests)
🔘 (none found) − ⏪ Replay Tests