Skip to content
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

perf tool enhancement #1545

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

perf tool enhancement #1545

wants to merge 1 commit into from

Conversation

Tofel
Copy link
Contributor

@Tofel Tofel commented Jan 9, 2025

Direct query comparison:

  • add threshold validation,
  • nil report validation,
  • better readability for infinite metric change (999% instead of 100% since in reality the change is infinite)
  • couple more unit tests for edge cases

Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes improve the logic for calculating percentage differences, handling edge cases, and validating thresholds in the comparison of reports. These modifications ensure more accurate and reliable performance analysis in benchmarking tests by accurately reflecting infinite changes, complete improvements, and handling nil reports or incorrect thresholds.

What

  • wasp/benchspy/report.go
    • Modified calculateDiffPercentage to handle cases of zero values more accurately, using conventions for infinite change and complete improvement.
    • Added early return conditions in CompareDirectWithThresholds for cases where reports are nil, improving error handling.
    • Introduced validateThresholds function to check if specified thresholds are within a valid range, enhancing input validation.
  • wasp/benchspy/report_test.go
    • Updated tests to reflect new logic for calculating percentage differences, specifically testing transitions from non-zero to zero and zero to non-zero values.
    • Added tests for handling nil reports, ensuring that appropriate errors are returned when reports are missing.
    • Included tests for verifying threshold validation, checking that errors are reported for thresholds outside the acceptable range.

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
48.2% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube

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.

1 participant