Skip to content

Conversation

@bmartel
Copy link
Contributor

@bmartel bmartel commented Jan 30, 2026

Problem

validateToNameTag() in ConfigValidator.js iterates over all tags to find matching names, creating O(n^2) complexity when validating toName bindings. For 200+ tags, this causes noticeable initialization delays.

Solution

  • Pre-build a Map<name, tag> during validation setup
  • validateToNameTag() now accepts this map for O(1) lookups
  • Optimize validateParentTag() and validateVisualTags() with similar techniques
  • Reduces validation from O(n^2) to O(n) for large configs

Files Changed

  • web/libs/editor/src/core/DataValidator/ConfigValidator.js

Jira

FIT-1330

Made with Cursor

The config validator was using O(n) flatTree.find() inside a loop,
resulting in O(n²) complexity. With large configs (200+ tags), this
caused noticeable delays during config validation.

Changes:
- validateToNameTag: Pre-build name->element Map for O(1) lookup
- validateParentTag: Convert parentTypes to Set for O(1) has() check
- validateVisualTags: Use module-level Set instead of inline array

This reduces validation complexity from O(n²) to O(n).
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

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

Files with missing lines Patch % Lines
...s/editor/src/core/DataValidator/ConfigValidator.js 92.85% 1 Missing ⚠️

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

HEAD has 1 upload less than BASE
Flag BASE (609d271) HEAD (f0b657b)
pytests 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #9299       +/-   ##
============================================
- Coverage    66.82%   56.04%   -10.78%     
============================================
  Files          830      575      -255     
  Lines        64879    41460    -23419     
  Branches     10971    11465      +494     
============================================
- Hits         43355    23238    -20117     
+ Misses       21520    18218     -3302     
  Partials         4        4               
Flag Coverage Δ
lsf-e2e 51.11% <92.85%> (-0.88%) ⬇️
lsf-integration 47.47% <92.85%> (-0.80%) ⬇️
lsf-unit 6.75% <64.28%> (-2.12%) ⬇️
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 30, 2026

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

Name Link
🔨 Latest commit f0b657b
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/697c14adf95d20000804e7d0
😎 Deploy Preview https://deploy-preview-9299--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-storybook ready!

Name Link
🔨 Latest commit f0b657b
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/697c14ad1cb4390008e68259
😎 Deploy Preview https://deploy-preview-9299--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 30, 2026

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit f0b657b
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/697c14ad30915e000893d9d7
😎 Deploy Preview https://deploy-preview-9299--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 heartex-docs ready!

Name Link
🔨 Latest commit f0b657b
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/697c14ad02a68f0008db9ae4
😎 Deploy Preview https://deploy-preview-9299--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.

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