• Zenon Mousmoulas's avatar
    Refactor views.utils.create_links_dict() for speed · 11c2cfc0
    Zenon Mousmoulas authored
    This iterates through all Link interfaces (in the typical use case this means
    all backbone interfaces, which can be a lot) and searches for all DataSources
    (via ifce.as_dict() -> ifce.get_datasources()), which hits the database with
    (somewhat) expensive queries, one for each ifce.
    Refactor so the database is hit only once with a list of ifce IDs, using a
    larger query which is considerably faster than the previous alternative.
    However this inevitably means sacrificing Django QuerySet semantics.
utils.py 9.74 KB