bug fix - html rendering when multiple percentiles are the same #490
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.
Summary
Fixes a bug when an HTML benchmark reports is generated. The HTML report crashes in the browsers with e.g.
Error: xs[2] == xs[3]when rendering distributions with consecutive duplicate percentile values.This occurs when benchmarks have limited data points (e.g., < 10 requests), causing multiple percentiles to collapse to the same value. The visualization library expects strictly increasing x-values and fails when encountering duplicates.
Root Cause
When a benchmark has very few successful requests (e.g., 3 requests), percentile calculations result in many duplicate values:
Details
_filter_duplicate_percentiles()helper function to remove consecutive duplicate percentile valuesmodel_dump()in_TabularDistributionSummaryto automatically apply filtering during HTML generationTest Plan
Unit Tests
uv run pytest tests/unit/benchmark/test_html_output.py -v # 8/8 tests passingUse of AI
## WRITTEN BY AI ##)