← Back to Pull requests

Ported union, difference, and intersect to clipper2-ts to improve performance #2997

Open
unknown opened this pull request with 193 lines diff across 2 files
View on GitHub
unknown unknown commented on Jan 10, 2026 01:21 UTC
Author

Addresses performance issues in these three packages introduced in v7.2.0.

Performance improvement summary:

| function | improvement |
|-|-|
| difference | 20x to 130x |
| intersect | 55x to 60x |
|union | 10x to 120x |

Requires a custom rollup config to support es5 minified output (clipper2-ts requires bigint, which needs to be polyfilled with the JSBI library before bundling). This should only be a temporary measure until we move to a more modern target on a major version release.

Inclusion of JSBI into minified output results in approx 40% bundle size increase. Feel performance is causing more pain than bundle size though, so still consider worth while. And as mentioned above, it won't be forever.

Adds a non-published "internal" module for shared code. Can be used for other packages as a way to avoid copy-pasting code.

Resolves #2851
Resolves #2833
Resolves #2955

Please provide the following when creating a PR:

  • Meaningful title, including the name of the package being modified.

  • Summary of the changes.

  • Heads up if this is a breaking change.

  • Any issues this resolves.

  • Inclusion of your details in the contributors field of package.json - you've earned it! 👏

  • Confirmation you've read the steps for preparing a pull request.
  • Diff: 193 lines (+144 / -49) across 2 files Reviewer: smallsaucepan Review duration: 467686m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.43) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 193 lines diff across 2 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.315
    Real PR Conversation Timeline
    1 comments
    "Review active on #2997"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.4% · Safe to merge
    25.4%
    Repository