Skip to content

Python: Implement ContentApprox - #21941

Merged
hvitved merged 1 commit into
github:mainfrom
hvitved:python/content-approx
Jun 9, 2026
Merged

Python: Implement ContentApprox#21941
hvitved merged 1 commit into
github:mainfrom
hvitved:python/content-approx

Conversation

@hvitved

@hvitvedhvitved commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

#21888 follow-up.

DCA shows a noticeable improvement for ytdl-org__youtube-dl, recovering performance lost from the PR mentioned above (this DCA run shows the combination of the two PRs).

@hvitved
hvitvedforce-pushed the python/content-approx branch from dc58e2f to cc1ea25CompareJune 8, 2026 06:41
@hvitvedhvitved added Actions Analysis of GitHub Actions no-change-note-required This PR does not need a change note and removed Actions Analysis of GitHub Actions labels Jun 8, 2026
@hvitved

hvitved commented Jun 8, 2026

Copy link
Copy Markdown
ContributorAuthor

@hvitved

hvitved commented Jun 8, 2026

Copy link
Copy Markdown
ContributorAuthor

@hvitved

hvitved commented Jun 8, 2026

Copy link
Copy Markdown
ContributorAuthor

@hvitved
hvitved marked this pull request as ready for review June 8, 2026 09:06
@hvitved
hvitved requested a review from a team as a code ownerJune 8, 2026 09:06
CopilotAI review requested due to automatic review settings June 8, 2026 09:06

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements a concrete ContentApprox representation for Python’s new dataflow internals, enabling a more structured approximation of Content (including dictionary elements and attribute content) to help recover performance lost after earlier precision improvements.

Changes:

  • Add helper predicates to derive a stable “first non-underscore character” approximation from strings used in content representations.
  • Introduce TContentApprox and implement ContentApprox as a proper newtype-backed class.
  • Implement getContentApprox(Content c) to map precise Content variants into the new approximation domain.
Show a summary per file
FileDescription
python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qllDefines ContentApprox as a real approximation type and implements mapping from Content into this approximation.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

@owen-mcowen-mc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. DCA shows improvement in one of the two projects that regressed a lot from the previous PR.

@hvitved
hvitved merged commit f591987 into github:mainJun 9, 2026
22 checks passed
@hvitved
hvitved deleted the python/content-approx branch June 9, 2026 13:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-requiredThis PR does not need a change notePython

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@hvitved@owen-mc