Skip to content

Conversation

@bmartel
Copy link
Contributor

@bmartel bmartel commented Jan 30, 2026

Problem

unionArray(), unionTag(), and tagsTypes() create new MST union types on every call. During tree building with large configs, identical unions are recreated thousands of times.

Solution

Add module-level caching:

  • Cache unionArray() results by array contents
  • Cache unionTag() results by tag type
  • Cache tagsTypes() results
  • Optimize getParentOfTypeString() and getParentTagOfTypeString() to use Set lookups

Files Changed

  • web/libs/editor/src/core/Types.js

Jira

FIT-1329

Made with Cursor

Large labeling configs create many identical union types, each
requiring expensive MST type construction. This adds multi-level
caching to avoid recreating identical types.

Changes:
- Cache unionArray() results by sorted array key
- Cache oneOfTags union types in _oneOf()
- Cache unionTag() enumeration types
- Cache tagsTypes() frozen types
- Cache allModelsTypes() result (invalidates when Registry changes)
- Convert O(n) arr.find()/includes() to O(1) Set.has() lookups
- Add Set-based lookups in getParentOfTypeString/getParentTagOfTypeString

With 200+ tags, this dramatically reduces tree building time by
avoiding redundant type construction and linear searches.
@netlify
Copy link

netlify bot commented Jan 30, 2026

Deploy Preview for heartex-docs ready!

Name Link
🔨 Latest commit 4e8196a
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/697c14a40c643a000860de57
😎 Deploy Preview https://deploy-preview-9298--heartex-docs.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 30, 2026

Deploy Preview for label-studio-docs-new-theme ready!

Name Link
🔨 Latest commit 4e8196a
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/697c14a45820ae00072603c0
😎 Deploy Preview https://deploy-preview-9298--label-studio-docs-new-theme.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 30, 2026

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 4e8196a
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/697c14a430bdc90008270a86
😎 Deploy Preview https://deploy-preview-9298--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 30, 2026

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 4e8196a
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/697c14a427b4e8000895f83a
😎 Deploy Preview https://deploy-preview-9298--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.

@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.88%. Comparing base (609d271) to head (4e8196a).
⚠️ Report is 25 commits behind head on develop.

Files with missing lines Patch % Lines
web/libs/editor/src/core/Types.js 98.24% 1 Missing ⚠️

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

HEAD has 1 upload less than BASE
Flag BASE (609d271) HEAD (4e8196a)
pytests 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #9298       +/-   ##
============================================
- Coverage    66.82%   55.88%   -10.95%     
============================================
  Files          830      575      -255     
  Lines        64879    41500    -23379     
  Branches     10971    11473      +502     
============================================
- Hits         43355    23192    -20163     
+ Misses       21520    18304     -3216     
  Partials         4        4               
Flag Coverage Δ
lsf-e2e 51.53% <98.24%> (-0.47%) ⬇️
lsf-integration 46.03% <98.24%> (-2.24%) ⬇️
lsf-unit 6.82% <63.15%> (-2.05%) ⬇️
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.

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.

2 participants