Changeset c837493 in trunk


Ignore:
Timestamp:
2019-03-14T17:11:47Z (6 years ago)
Author:
Jean-Paul Calderone <exarkun@…>
Branches:
master
Children:
dd7cb99
Parents:
05eab3ce
git-author:
Jean-Paul Calderone <exarkun@…> (2019-03-11 16:26:53)
git-committer:
Jean-Paul Calderone <exarkun@…> (2019-03-14 17:11:47)
Message:

Avoid some function dispatch overhead

Also, we might avoid some dict lookup overhead by being optimistic about
finding the entry. At worst, we do two lookups - which is just what we did
before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/frontends/magic_folder.py

    r05eab3ce rc837493  
    18701870                    (local_dbentry.version == remote_version and local_dbentry.last_downloaded_uri != remote_uri)):
    18711871                    ADD_TO_DOWNLOAD_QUEUE.log(relpath=relpath_u)
    1872                     if scan_batch.has_key(relpath_u):
     1872
     1873                    # The scan_batch is shared across the scan of multiple
     1874                    # DMDs.  It is expected the DMDs will most often be mostly
     1875                    # synchronized with each other.  The common case, then, is
     1876                    # that there is already an entry for relpath_u.  So try to
     1877                    # make that the fast path: assume there is a value already
     1878                    # and extend it.  If there's not, we'll do an extra lookup
     1879                    # to initialize it.
     1880                    try:
    18731881                        scan_batch[relpath_u] += [(file_node, metadata)]
    1874                     else:
     1882                    except KeyError:
    18751883                        scan_batch[relpath_u] = [(file_node, metadata)]
    18761884            self._status_reporter(
Note: See TracChangeset for help on using the changeset viewer.