Skip to content

Add a stub overview section to folded report#356

Merged
JiriPavela merged 1 commit intoPerfexionists:develfrom
JiriPavela:feature/report-overview-data
Mar 30, 2026
Merged

Add a stub overview section to folded report#356
JiriPavela merged 1 commit intoPerfexionists:develfrom
JiriPavela:feature/report-overview-data

Conversation

@JiriPavela
Copy link
Copy Markdown
Collaborator

The overview section will list top baseline-only, target-only, and common traces and functions w.r.t some diff metrics. This PR adds the propagation of the computed results into the HTML report so that the frontend can read the data.

@tfiedor tfiedor self-requested a review March 30, 2026 17:30
Copy link
Copy Markdown
Collaborator

@tfiedor tfiedor left a comment

Choose a reason for hiding this comment

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

LGTM, made few suggestions that might help readability.

Also it might make sense to invest (you can try claude/codex/whatever) some effort to pack the whitespaces in the jinja template (in my experience, it can save quite some bytes in these reports).

common_lf.bottom_k(records_num, by=exclusive_diff_key),
# Inclusive diff metric.
find_top_diffs(baseline_only_lf, records_num, symbol_key, inclusive_diff_key),
find_top_diffs(baseline_only_lf, records_num, symbol_key, inclusive_diff_key, False),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would suggest to use keyword for the False so it is better readable, since this way one does not know immediately what is the parameter there), so top=False.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, fixed.



def find_top_diffs(
data_lf: pl.LazyFrame, count: int, symbol_key: str, diff_key: str, top: bool = True
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I kindof like using * as follows:

Suggested change
data_lf: pl.LazyFrame, count: int, symbol_key: str, diff_key: str, top: bool = True
data_lf: pl.LazyFrame, count: int, symbol_key: str, diff_key: str, *, top: bool = True

That forces the top to be used as keyword argument always. When you have many parameters or booleans I think it is godsend.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.


:return: a lazy frame containing the maximal/minimal records.
"""
search_func = pl.LazyFrame.top_k if top else pl.LazyFrame.bottom_k
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would make sense to also switch from boolean parameter to supply the function; but looks like we have two uses cases anyway so it is fine.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This would normally be the preferred option to a bool parameter, but the top_k and bottom_k polars functions have quite complex types, which would make the type hints of this little helper function too cumbersome.

The overview section will list top baseline-only, target-only, and
common traces and functions w.r.t some diff metrics. This commit
adds the propagation of the computed results into the HTML report.
@JiriPavela JiriPavela force-pushed the feature/report-overview-data branch from 43e0af8 to 21b6b94 Compare March 30, 2026 20:17
@JiriPavela
Copy link
Copy Markdown
Collaborator Author

LGTM, made few suggestions that might help readability.

Also it might make sense to invest (you can try claude/codex/whatever) some effort to pack the whitespaces in the jinja template (in my experience, it can save quite some bytes in these reports).

This is a good suggestion. Rather than just removing the whitespace, I think we should instead try to use something similar to JS minification, which has the potential to save even more space.

@JiriPavela JiriPavela merged commit 3ca6244 into Perfexionists:devel Mar 30, 2026
25 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