Skip to content

perf: FIT-1298: Cache Area union types by tag type in dispatcher#9264

Open
bmartel wants to merge 1 commit intodevelopfrom
fb-fit-1298
Open

perf: FIT-1298: Cache Area union types by tag type in dispatcher#9264
bmartel wants to merge 1 commit intodevelopfrom
fb-fit-1298

Conversation

@bmartel
Copy link
Contributor

@bmartel bmartel commented Jan 26, 2026

Problem

The Area dispatcher creates a new types.union() for every region deserialization, even when the same tag type would produce the same union. For annotations with many regions, this creates thousands of duplicate union types.

Solution

Add a cache keyed by tag type so that the union is only created once per tag type and reused for subsequent areas of the same type.

Files Changed

  • web/libs/editor/src/regions/Area.js

The Area dispatcher was creating a new types.union() for every area
deserialization, even when the same tag type would produce the same
union. For annotations with many regions, this created thousands of
duplicate union types.

Added a cache keyed by tag type so that the union is only created
once per tag type and reused for subsequent areas of the same type.
@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.13%. Comparing base (609d271) to head (8d70a95).
⚠️ Report is 8 commits behind head on develop.

❗ There is a different number of reports uploaded between BASE (609d271) and HEAD (8d70a95). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (609d271) HEAD (8d70a95)
pytests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9264      +/-   ##
===========================================
- Coverage    66.82%   57.13%   -9.69%     
===========================================
  Files          830      561     -269     
  Lines        64879    40553   -24326     
  Branches     10971    11009      +38     
===========================================
- Hits         43355    23170   -20185     
+ Misses       21520    17379    -4141     
  Partials         4        4              
Flag Coverage Δ
lsf-e2e 50.96% <100.00%> (-1.04%) ⬇️
lsf-integration 47.97% <100.00%> (-0.30%) ⬇️
lsf-unit 8.85% <0.00%> (-0.02%) ⬇️
pytests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 8d70a95
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6977b0142e88130008027e35
😎 Deploy Preview https://deploy-preview-9264--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 8d70a95
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/6977b014c53dd1000863ca3a

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 8d70a95
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/6977b014384de300088177d2
😎 Deploy Preview https://deploy-preview-9264--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 8d70a95
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/6977b0143b072a0008e4340e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant