Skip to content

Subclass JsonForms from ResolvedJsonForms. - #1214

Merged
edgarmueller merged 3 commits into
eclipsesource:masterfrom
nowells:resolved-json-forms
Jan 9, 2019
Merged

edgarmueller merged 3 commits into
eclipsesource:masterfrom
nowells:resolved-json-forms

Conversation

@nowells

@nowells nowells commented Jan 9, 2019 •

Copy link
Copy Markdown
Contributor

When running with @jsonforms/react there is a significant performance issue when rendering a form with a lot of fields. I believe I have tracked this down to excessive calls to hasRefs. As I understand the code, that deferred call to resolve the refs on the schema, only needs to happen once on the root JsonForms component, as it will pass/provide the already resolve schema down to children, however, all of the children are also performing the hasRefs check, even though there will be no refs as the root JsonForms component has resolve them. hasRefs is an expensive call, especially when run on a large form. I was able to drop render time from 30s to 3 seconds by removing that call.

This is an alternate solution to #1209 (and #1208) which takes the route of subclassing the JsonForms to allow renderers that are not at the root to explicitly include a JsonForms that already has the schema fully resolved and avoid the expensive penalties of hasRefs checks.

Fixes: #1209
Fixes: #1208

This is an alternate solution to eclipsesource#1209 (and eclipsesource#1208) which takes the route
of subclassing the JsonForms to allow renderers that are not at the root
to explicitly include a JsonForms that already has the schema fully resolved
and avoid the expensive penalties of hasRefs checks.

Fixes: eclipsesource#1209
Fixes: eclipsesource#1208
@coveralls

coveralls commented Jan 9, 2019 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.01%) to 88.018% when pulling 6de2823 on nowells:resolved-json-forms into fcaa55e on eclipsesource:master.

@edgarmueller
edgarmueller requested a review from eneufeld January 9, 2019 11:56

@eneufeld eneufeld left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@edgarmueller
edgarmueller merged commit ee3374d into eclipsesource:master Jan 9, 2019
@edgarmueller

Copy link
Copy Markdown
Contributor

LGTM, thanks!

@nowells

nowells commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

Thanks @edgarmueller!!!

@edgarmueller edgarmueller added this to the 2.2.0 milestone Jan 30, 2019
nowells added a commit to nowells/jsonforms that referenced this pull request Mar 12, 2020
I introduced a fix in eclipsesource#1214
to fix performance of rendering lots of fields. The problem stemming from
`JsonFormsDispatchRenderer` calling `hasRefs` while `ResolvedJsonFormsDispatchRenderer`
does not, as only the first JsonForm needs to handle processing resolving refs. Right now
we are doing a lot of wasted `object-hash` comparisons in the `hasRefs` memoized check
due to using the wrong component in our `material` and `vanilla` components.
sdirix pushed a commit to nowells/jsonforms that referenced this pull request Mar 20, 2020
During refactorings the performance fix introduced in eclipsesource#1214 was lost.
The fix is now integrated again.

In general we should use the 'ResolvedJsonFormsDispatch' as often as
possible as the 'hasRef' and 'resolveRef' calls are very expensive.
sdirix pushed a commit that referenced this pull request Mar 20, 2020
During refactorings the performance fix introduced in #1214 was lost.
The fix is now integrated again.

In general we should use the 'ResolvedJsonFormsDispatch' as often as
possible as the 'hasRef' and 'resolveRef' calls are very expensive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React performance problem with excessive calls to hasRefs

4 participants