• rlarocque@chromium.org's avatar
    sync: Better iteration in GenericChangeProcessor · 414df42f
    rlarocque@chromium.org authored
    This change introduces a new function for fetching the handles of all
    children of a sync node, then puts it to use in optimizing the
    GenericChangeProcessor's GetSyncDataForType() function.
    
    Prior to the UniquePosition changes, it was simple and cheap to fetch
    the ID of a successor or predecessor item.  After the change, it
    requires a few expensive map lookups.  In other words, GetSuccessorId()
    has gone from being O(1) to O(lg(n)).  This is a especially a problem in
    code paths where we use GetSuccessorId() to iterate over all nodes in a
    folder.
    
    The UniquePosition change also makes it pretty easy to fetch all child
    nodes under a given parent.  We could easily return all the EntryKernels
    under a given folder.  Unfortunately, the APIs don't make it easy to
    expose that functionality.  Instead, we do something less efficient, but
    still much better than the status quo: return the IDs of all the
    children.  The caller will need to look up each entry at O(lg(n)) cost,
    but at least it didn't have to do two lookups to fetch each ID.
    
    This change should lead to a slight performance improvement in the
    ModelAssociation time of types that use the GenericChangeProcessor.
    
    BUG=178275, 241813
    
    Review URL: https://chromiumcodereview.appspot.com/14667013
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202673 0039d316-1c4b-4281-b951-d872f2087c98
    414df42f
chrome_tests_unit.gypi 136 KB