Reduce Position#parent use by 50%+ #6579
Labels
package:engine
type:improvement
This issue reports a possible enhancement of an existing feature.
type:performance
This issue reports a performance issue or a possible performance improvement.
type:refactor
This issue requires or describes a code refactoring.
Milestone
📝 Provide a description of the improvement
This is a performance graph for undoing removal of the "long (semantic)" content in http://localhost:8125/ckeditor5/tests/manual/performance/setdata.html.
As you can see
Position#parent
is the most expensive thing here. We could not find ways to make it much faster by changing its implementation.However, then I noticed when it's used and after looking at implementation of
#nodeAfter
,#nodeBefore
, and#textNode
I realised that we're executing the#parent
getter many times per each of these prop getters calls.You can find the current implementation of these functions here: https://github.com/ckeditor/ckeditor5-engine/blob/ff045099fdea35c2af90a6da3d1a546845aeb3ea/src/model/position.js#L199-L242
Let's see if we can save 50%+ of time by rewriting them into uglier, but more optimal forms :).
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: