Skip to content

Refactor: Improve time and size calculations in output #16

Merged
izzet merged 19 commits intollnl:mainfrom
izzet:fix/time-calc-output
Aug 2, 2025
Merged

Refactor: Improve time and size calculations in output #16
izzet merged 19 commits intollnl:mainfrom
izzet:fix/time-calc-output

Conversation

@izzet
Copy link
Collaborator

@izzet izzet commented Jul 26, 2025

This pull request refactors and enhances the dfanalyzer/output.py file 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:

  • Introduced _format_val and _format_val_with_ovlp_pct helper 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:

  • Refactored the logic in _create_summary to use a clearer is_process_based flag 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))
  • Enhanced _create_layer_breakdown_table to 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))

@izzet izzet requested a review from Copilot July 26, 2025 06:46
@izzet izzet self-assigned this Jul 26, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_val and _format_val_with_ovlp_pct to eliminate code duplication in value formatting
  • Refactors conditional logic to use clearer is_process_based flag for time metric calculations
  • Enhances layer breakdown table to conditionally show overlap percentages only when multiple layers exist

@izzet izzet merged commit e2a9dea into llnl:main Aug 2, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants