Add perf comments

This commit is contained in:
Joseph Schorr 2014-11-05 12:27:38 -05:00
parent 408fd229a7
commit a35bc11912
4 changed files with 20 additions and 0 deletions

View file

@ -1148,6 +1148,8 @@ def __translate_ancestry(old_ancestry, translations, repository, username, prefe
return translations[old_id]
# TODO: PERFORMANCE IMPROVMENT: Select all the ancestor Docker IDs in a single query. The values
# are retrieved in the above translate call.
old_ids = [int(id_str) for id_str in old_ancestry.split('/')[1:-1]]
new_ids = [str(translate_id(old_id)) for old_id in old_ids]
return '/%s/' % '/'.join(new_ids)
@ -1164,6 +1166,9 @@ def _create_storage(location_name):
def find_create_or_link_image(docker_image_id, repository, username, translations,
preferred_location):
with config.app_config['DB_TRANSACTION_FACTORY'](db):
# TODO PERF IMPROVEMENT: Also make this only lookup the image directly, rather than
# joining image and image storage, etc. The common case doesn't need that information
# (but other callers might, so double check)
repo_image = get_repo_image(repository.namespace_user.username, repository.name,
docker_image_id)
if repo_image: