Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large form is slow in Form Builder in part due to `createTemplateContentFromBindName` #4268

Closed
ebruchez opened this issue Nov 13, 2019 · 8 comments

Comments

@ebruchez
Copy link
Collaborator

@ebruchez ebruchez commented Nov 13, 2019

We recreate all templates (#2440). Here, this takes about 60% of the form's loading time.

Screen Shot 2019-11-13 at 3 50 54 PM

+1 from customer

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 14, 2019

There are 29 templates. Other stats:

Screen Shot 2019-11-13 at 4 02 57 PM

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 14, 2019

The longest one takes more than 2 seconds. Total is about 14 seconds.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 14, 2019

2404 calls to findControlByName during that process, and the index cannot be used as the document is not in an instance. Creating a Map before takes this down to 580 ms, which is good to take!

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 14, 2019

  • fix createTemplateContentFromBindName
  • fix findBlankHelpHoldersAndElements, which takes 2100 ms
  • when above is fixed, run profiler again
@ebruchez ebruchez added this to In progress in Orbeon Forms 2019.2 Nov 14, 2019
@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 21, 2019

findBlankHelpHoldersAndElements is very inefficient on a large document.

The source document doesn't have an id index, as it's in XSLT and it doesn't register id attributes as ids (it does for xml:id however. I thought about calling registerID(), but that is package-protected so it's a pain to work around.

We could hold our own index.

Or we could change the algorithm to be faster and not use random access of controls.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 21, 2019

Right now, findBlankHelpHoldersAndElements iterates the whole doc to find xf:help (only the body would be enough as we don't process section templates here) then for each calls hasBlankOrMissingLHHAForAllLangsUseDoc and, if found, lhhaHoldersForAllLangsUseDoc. Here we don't find any matches so lhhaHoldersForAllLangsUseDoc is not called.

hasBlankOrMissingLHHAForAllLangsUseDoc:

  • calls findControlByName to find if the help has params
  • then checks the resources

We should be able to avoid the call to findControlByName.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Nov 21, 2019

Doing the above, we go from ~2 s to ~60 ms.

The form still takes about 10 seconds to load in Form Builder.

@ebruchez

This comment has been minimized.

Copy link
Collaborator Author

@ebruchez ebruchez commented Dec 5, 2019

We can certainly do more, but we'll enter other issues as needed. Closing for now.

@ebruchez ebruchez closed this Dec 5, 2019
Orbeon Forms 2019.2 automation moved this from In progress to Done Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
1 participant
You can’t perform that action at this time.