mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
bitbake: toaster: reduce redundant foreign key lookups
Replace redundant foreign key lookups with "with" to improve all recipes page load time. Do depends pre-lookup in the view class, and use python itertation instead of filter() all to achieve x16 processing speedup. [YOCTO #6137] (Bitbake rev: a68a6dc50c11cc59e7c873414e3e22ac2644dea7) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Conflicts: bitbake/lib/toaster/toastergui/views.py Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
defe227135
commit
bf9ff3de5f
@@ -45,31 +45,39 @@
|
|||||||
<td><a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.version}}</a></td>
|
<td><a href="{% url "recipe" build.pk recipe.pk %}">{{recipe.version}}</a></td>
|
||||||
<!-- Depends -->
|
<!-- Depends -->
|
||||||
<td class="depends_on">
|
<td class="depends_on">
|
||||||
{% if recipe.r_dependencies_recipe.all.count %}
|
{% with deps=recipe_deps|get_dict_value:recipe.pk %}
|
||||||
|
{% with count=deps|length %}
|
||||||
|
{% if count %}
|
||||||
<a class="btn"
|
<a class="btn"
|
||||||
title="<a href='{% url "recipe" build.pk recipe.pk %}#dependencies'>{{recipe.name}}</a> dependencies"
|
title="<a href='{% url "recipe" build.pk recipe.pk %}#dependencies'>{{recipe.name}}</a> dependencies"
|
||||||
data-content="<ul class='unstyled'>
|
data-content="<ul class='unstyled'>
|
||||||
{% for i in recipe.r_dependencies_recipe.all|dictsort:"depends_on.name"%}
|
{% for i in deps|dictsort:"depends_on.name"%}
|
||||||
<li><a href='{% url "recipe" build.pk i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
|
<li><a href='{% url "recipe" build.pk i.depends_on.pk %}'>{{i.depends_on.name}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>">
|
</ul>">
|
||||||
{{recipe.r_dependencies_recipe.all.count}}
|
{{count}}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
</td>
|
</td>
|
||||||
<!-- Brought in by -->
|
<!-- Brought in by -->
|
||||||
<td class="depends_by">
|
<td class="depends_by">
|
||||||
{% if recipe.r_dependencies_depends.all.count %}
|
{% with revs=recipe_revs|get_dict_value:recipe.pk %}
|
||||||
|
{% with count=revs|length %}
|
||||||
|
{% if count %}
|
||||||
<a class="btn"
|
<a class="btn"
|
||||||
title="<a href='{% url "recipe" build.pk recipe.pk %}#brought-in-by'>{{recipe.name}}</a> reverse dependencies"
|
title="<a href='{% url "recipe" build.pk recipe.pk %}#brought-in-by'>{{recipe.name}}</a> reverse dependencies"
|
||||||
data-content="<ul class='unstyled'>
|
data-content="<ul class='unstyled'>
|
||||||
{% for i in recipe.r_dependencies_depends.all|dictsort:"recipe.name"%}
|
{% for i in revs|dictsort:"recipe.name" %}
|
||||||
<li><a href='{% url "recipe" build.pk i.recipe.pk %}'>{{i.recipe.name}}</a></li>
|
<li><a href='{% url "recipe" build.pk i.recipe.pk %}'>{{i.recipe.name}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>">
|
</ul>">
|
||||||
{{recipe.r_dependencies_depends.all.count}}
|
{{count}}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
</td>
|
</td>
|
||||||
<!-- Recipe file -->
|
<!-- Recipe file -->
|
||||||
<td class="recipe_file">{{recipe.file_path}}</td>
|
<td class="recipe_file">{{recipe.file_path}}</td>
|
||||||
|
|||||||
Regular → Executable
+15
@@ -1074,11 +1074,26 @@ def recipes(request, build_id):
|
|||||||
|
|
||||||
recipes = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
|
recipes = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
|
||||||
|
|
||||||
|
# prefetch the forward and reverse recipe dependencies
|
||||||
|
deps = { }; revs = { }
|
||||||
|
queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id)
|
||||||
|
for recipe in recipes:
|
||||||
|
deplist = [ ]
|
||||||
|
for recipe_dep in [x for x in queryset_dependency if x.recipe_id == recipe.id]:
|
||||||
|
deplist.append(recipe_dep)
|
||||||
|
deps[recipe.id] = deplist
|
||||||
|
revlist = [ ]
|
||||||
|
for recipe_dep in [x for x in queryset_dependency if x.depends_on_id == recipe.id]:
|
||||||
|
revlist.append(recipe_dep)
|
||||||
|
revs[recipe.id] = revlist
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'objectname': 'recipes',
|
'objectname': 'recipes',
|
||||||
'build': Build.objects.filter(pk=build_id)[0],
|
'build': Build.objects.filter(pk=build_id)[0],
|
||||||
'objects': recipes,
|
'objects': recipes,
|
||||||
'default_orderby' : 'name:+',
|
'default_orderby' : 'name:+',
|
||||||
|
'recipe_deps' : deps,
|
||||||
|
'recipe_revs' : revs,
|
||||||
'tablecols':[
|
'tablecols':[
|
||||||
{
|
{
|
||||||
'name':'Recipe',
|
'name':'Recipe',
|
||||||
|
|||||||
Reference in New Issue
Block a user