This Engineering Notebook post discusses the aftermath of PR #2803 
<https://github.com/leo-editor/leo-editor/pull/2803>, containing a huge 
speedup in qtree.redraw_after_icons_changed.

*tl;dr:* redraw_after_icons_changed is a faux helper!

*Background*

The old code (qtree.redraw_after_icons_changed) updated *all* visible nodes 
in the entire tree, a huge waste of time. Instead, the new code updates 
only c.p and its direct parents.

However, the new code is dubious, because p.setAllAncestorAtFileNodesDirty 
is complicated. It can "dirty" nodes far outside of c.p's ancestors or 
descendants.


*Aha: updating icons is easier without a helper*

The new version of qtree.redraw_after_icons_changed just calls 
qtree.updateIcon(p) for a few positions. But there are two Ahas:

*Aha 1*: Calling updateIcon(p) would be easy to do anywhere!
*Aha 2*: qtree.redraw_after_icons_changed can't know which positions to 
update!

In short: *redraw_after_icons_changed is a faux helper*. 

*Summary*

There is no need for AI in a faux helper. Leo's core code will call 
c.updateIcon(p) directly. Finding that code is easy: just look calls for 
the faux helper! 

I'll soon retire all x.redraw_after_icons_changed methods.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/689d7879-8258-4f3c-a7d3-a82a6b67c59bn%40googlegroups.com.

Reply via email to