AllenNeuralDynamics / aind-metadata-entry-js

Metadata entry using javascript
https://metadata-entry.allenneuraldynamics.org
MIT License
1 stars 1 forks source link

Inputs are very laggy with complicated rig.jsons #162

Closed helen-m-lin closed 4 months ago

helen-m-lin commented 5 months ago

Describe the bug A few users have reported noticeable lagging when entering complex rig metadata. For example, dropdowns take a few seconds to render, or the text input would not change the displayed value as the user is typing.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://metadata-entry.allenneuraldynamics.org/
  2. Click on 'Select schema' dropdown and select Rig
  3. Scroll down to add multiple subschemas.
  4. Observe that the input fields have more delay as the formData gets longer.

Expected behavior We should investigate this and see if it is an issue with rjsf, our custom widgets, or the Rig JSON schema itself.

Desktop (please complete the following information):

Additional context I did a quick comparison and noticed comparable lagging even without the CustomTextWidget and also on rjsf playground.

dyf commented 5 months ago

dupe of #159

helen-m-lin commented 4 months ago

Profiling shows that for empty Rig, we have keyboard events taking approx. 200ms to process, and for "filled" Rig each keyboard event can take up to 2.5s. The performance issue is due to a few embedded calls to AJV8Validator.isValid() and Ajv.addSchema()- 94% of total time is spent through json-schema-traverse

Relevant issue in RJSF repo: https://github.com/rjsf-team/react-jsonschema-form/issues/3715

I will do some more profiling and look at ways to mitigate or improve the performance.

Image

Image

helen-m-lin commented 4 months ago

Bulk of performance issues are linked to liveOmit in the RJSF form because liveOmit runs AJV validator on every change/keystroke.

Mitigation: Disable liveOmit option in RJSF form

Blocker: Potential bug in RJSF with omitExtraData