Refactor: Improve time and size calculations in output #16
Merged
Conversation
…ask dependency version
…ask dependency version
…stency and performance
…er clarity and performance
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the dfanalyzer/output.py file to improve code maintainability and clarity through better separation of concerns and conditional logic. The refactoring introduces helper methods for value formatting and improves the handling of overlap percentages in table displays.
- Introduces helper methods
_format_valand_format_val_with_ovlp_pctto eliminate code duplication in value formatting - Refactors conditional logic to use clearer
is_process_basedflag for time metric calculations - Enhances layer breakdown table to conditionally show overlap percentages only when multiple layers exist
…date related logic; enhance ConsoleOutput to skip views not in result types
…dictionary; enhance view aggregation logic to include logical views
…ues and improve readability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and enhances the
dfanalyzer/output.pyfile to improve code readability, maintainability, and functionality. Key changes include the introduction of helper methods for formatting values, conditional logic improvements, and better handling of overlap percentages in tables.Refactoring and Code Simplification:
_format_valand_format_val_with_ovlp_pcthelper methods to replace repetitive formatting logic, improving code reuse and readability. ([dfanalyzer/output.pyL221-R256](https://github.com/llnl/dfanalyzer/pull/16/files#diff-72b72e576967011f3535ce68644ac5b65d74c76cd3687726af3b6340e65e3157L221-R256))Improved Conditional Logic:
_create_summaryto use a cleareris_process_basedflag for determining whether to sum or take the maximum of time metrics. ([[1]](https://github.com/llnl/dfanalyzer/pull/16/files#diff-72b72e576967011f3535ce68644ac5b65d74c76cd3687726af3b6340e65e3157L82-R87),[[2]](https://github.com/llnl/dfanalyzer/pull/16/files#diff-72b72e576967011f3535ce68644ac5b65d74c76cd3687726af3b6340e65e3157R101-R103))_create_layer_breakdown_tableto dynamically adjust the title and overlap percentage display based on the number of layers, improving clarity and reducing unnecessary calculations. ([[1]](https://github.com/llnl/dfanalyzer/pull/16/files#diff-72b72e576967011f3535ce68644ac5b65d74c76cd3687726af3b6340e65e3157L161-R173),[[2]](https://github.com/llnl/dfanalyzer/pull/16/files#diff-72b72e576967011f3535ce68644ac5b65d74c76cd3687726af3b6340e65e3157L172-R197))