-
Notifications
You must be signed in to change notification settings - Fork 4.6k
⚡️ Speed up method EntrypointOutput.is_in_logs
by 92% in PR #44444 (artem1205/airbyte-cdk-protocol-dataclasses-serpyco-rs
)
#44868
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
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]>
…(`artem1205/airbyte-cdk-protocol-dataclasses-serpyco-rs`) To optimize the given Python program for faster execution, we'll focus on improving the list comprehension within the `__init__` method and optimizing the `is_in_logs` method. We will use more efficient coding practices and eliminate unnecessary operations where possible. Here's the optimized version of the program. ### Changes and Improvements. 1. **List Comprehension to For Loop**: Converted the list comprehension in `__init__` method to a `for` loop for clarity and debugging ease. 2. **Cache the Compiled Regex**: In `is_in_logs`, precompiled the regex pattern outside the loop. This avoids recompiling the pattern on every iteration which is more efficient. 3. **Direct Filtering in Logs**: Simplified `_get_message_by_types` logic by using direct filtering inline in the `logs` property.
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
.📄
EntrypointOutput.is_in_logs()
inairbyte-cdk/python/airbyte_cdk/test/entrypoint_wrapper.py
📈 Performance improved by
92%
(0.92x
faster)⏱️ Runtime went down from
11.7 milliseconds
to6.07 milliseconds
Explanation and details
To optimize the given Python program for faster execution, we'll focus on improving the list comprehension within the
__init__
method and optimizing theis_in_logs
method. We will use more efficient coding practices and eliminate unnecessary operations where possible.Here's the optimized version of the program.
Changes and Improvements.
__init__
method to afor
loop for clarity and debugging ease.is_in_logs
, precompiled the regex pattern outside the loop. This avoids recompiling the pattern on every iteration which is more efficient._get_message_by_types
logic by using direct filtering inline in thelogs
property.Correctness verification
The new optimized code was tested for correctness. The results are listed below.
🔘 (none found) − ⚙️ Existing Unit Tests
✅ 17 Passed − 🌀 Generated Regression Tests
(click to show generated tests)
🔘 (none found) − ⏪ Replay Tests