More strange things...
here is the declaration of p.setAllAncestorsAtFileNodesDirty
# module leoNodes
# class Position
def setAllAncestorAtFileNodesDirty(self, setDescendentsDirty=False)

This method is called in about 30-50 places inside LeoPyRef.leo. In all 
those places but two, call is made without specifying setDescendentsDirty. 
In one place this argument is specified as False, and in one place it is 
specified as True.

The only place it is specified as var is in leoNodes.Position.setDirty 
which just propagates its own default argument with the same name but with 
the default set to True.

Looking through places where p.setDirty is called I have found this one:
# module leo.core.commanderOutlineCommands
# command 'insert-node-before'@g.commander_command('insert-node-before')

@g.commander_command('insert-node-before')
def insertHeadlineBefore(self, event=None):
    '''Insert a node before the presently selected node.'''
    c, current, u = self, self.p, self.undoer
    op_name = 'Insert Node Before'
    if not current: return
    # Can not insert before the base of a hoist.
    if c.hoistStack and current == c.hoistStack[-1].p:
        g.warning('can not insert a node before the base of a hoist')
        return
    c.endEditing()
    undoData = u.beforeInsertNode(current)
    p = current.insertBefore()
    g.doHook('create-node', c=c, p=p)
    p.setDirty(setDescendentsDirty=False)
    dirtyVnodeList = p.setAllAncestorAtFileNodesDirty()
    c.setChanged(True)
    u.afterInsertNode(p, op_name, undoData, dirtyVnodeList=dirtyVnodeList)
    c.redrawAndEdit(p, selectAll=True)
    return p

Pay attention on two consecutive lines:
p.setDirty(setDescendentsDirty=False)
dirtyVnodeList = p.setAllAncestorAtFileNodesDirty()

p.setAllAncestorAtFileNodesDirty has just been called inside p.setDirty, 
and the very next call is to repeat what has already be done.

No wander that p.setDirty is expensive.

 

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to