Avoid slow HTML parsing in hierarchy sort function #1383
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reasons for creating this PR
The rendering of the concept hierarchy was very slow in some cases, see #1377. The reason is that HTML code is being parsed within the
nodeLabelSortKey
function and this can be very slow when there are many concepts shown in the hierarchy. This PR changes the waynodeLabelSortKey
is implemented to avoid the slow HTML parsing, thus making the hierarchy show up a lot faster.I couldn't find an easy way to benchmark this but the speedup is quite dramatic for instance in the case of the YSO concept "haircutting" that was used as an example in #1377.
Link to relevant issue(s), if any
Description of the changes in this PR
label
(similar to e.g.uri
andnotation
)Known problems or uncertainties in this PR
This PR changes the functions
createConceptObject
,createObjectsFromChildren
,vocabRoot
andcreateObjectsFromNarrowers
which are also overridden in thefooter.inc
file which is part of the Finto customizations. If you have installed the customizations as they are currently written, this code will not work properly because thelabel
attribute will be missing from nodes. The changes need to be applied tofooter.inc
as well. I will do that shortly.Checklist
.sr-only
class, color contrast)