-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Perpartition with global - Regression Tests #45415
base: master
Are you sure you want to change the base?
Perpartition with global - Regression Tests #45415
Conversation
… tolik0/airbyte-cdk/perpartition-with-global-regression-tests
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
… tolik0/airbyte-cdk/perpartition-with-global-regression-tests
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
…n PR #45415 (`tolik0/airbyte-cdk/perpartition-with-global-regression-tests`) To optimize the provided code for better performance, the main areas of focus include reducing redundant computations and minimizing potential thread contention. The logic and structure remain the same. Here is the refactored and optimized code. ### Summary of Optimizations 1. **Consolidated Conditional Checks**: Simplified boolean checks to make them more efficient. 2. **Lazy Evaluations/Short-circuiting**: Used more efficient conditional statements to avoid redundant operations when not necessary. 3. **Intermediate Variables**: Directly accessed dictionary elements where possible to avoid redundant intermediate variables. 4. **Reduced Lock Contention**: No change here as the current implementation handles threading with minimal contention; the threading lock and semaphore usage seem appropriate for their purpose. Note that no memory or extensive runtime profiling was done, but these changes streamline the control flow and simplify some operations, which should yield runtime improvements.
⚡️ Codeflash found optimizations for this PR📄
|
⚡️ Codeflash found optimizations for this PR📄
|
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
…e-cdk/perpartition-with-global-regression-tests`) Explanation of changes.
⚡️ Codeflash found optimizations for this PR📄
|
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
@@ -25,7 +55,7 @@ def start(self) -> None: | |||
|
|||
def finish(self) -> int: | |||
if self._start: | |||
return int((time.perf_counter_ns() - self._start) // 1e9) | |||
return ((time.perf_counter_ns() - self._start) / 1e9).__ceil__() |
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.
return ((time.perf_counter_ns() - self._start) / 1e9).__ceil__() | |
return (time.perf_counter_ns() - self._start + 999_999_999) // 1_000_000_000 |
⚡️ Codeflash found optimizations for this PR📄
|
…45415 (`tolik0/airbyte-cdk/perpartition-with-global-regression-tests`) To optimize this Python program for better runtime performance, we can take several steps. The main points for optimization involve reducing redundant operations and leveraging efficient data structures and algorithms. With that in mind, here's the optimized code. ### Explanation. 1. **Removed Unnecessary Attributes**: The attribute `_over_limit` was removed because it's not used elsewhere in the code. 2. **Optimized Dictionary Update**: For updating `self._cursor_per_partition`, used dictionary comprehensions for efficiency. 3. **Streamlined Setup**: Simplified the logic inside `set_initial_state` to reduce lookups and make the code more efficient. Specifically, checked for 'states' directly within the dictionary. 4. **General Cleanup**: Eliminated unnecessary comments and clarified existing ones for better readability and maintenance. These changes should help improve the runtime performance of the function, especially in scenarios involving many partitions and states.
⚡️ Codeflash found optimizations for this PR📄
|
…ck' into tolik0/airbyte-cdk/perpartition-with-global-regression-tests
What
This PR is created to run the regression tests with the new cursor in low code - Per Partition with