I create a tree menu with:
<!--includes/menu-links.html-->
{% for link in links %}
<li>
<a href="{{ link.href }}">{{ link.name }}</a>
{% if link.sublinks %}
<ul>
{% include "includes/menu-links.html" with ['links': link.sublinks] %}
</ul>
{% endif %}
</li>
{% endfor %}
call:
<ul class="main-menu">
{% include "includes/menu-links.html" with ['links':links] %}
</ul>
or
<!--macros/menu-macros.html-->
{% macro menu_links(links) %}
{% for link in links %}
<li>
<a href="{{ link.href }}">{{ link.name }}</a>
{% if link.sublinks %}
<ul>
{{ menu_links(link.sublinks) }}
</ul>
{% endif %}
</li>
{% endfor %}
{% endmacro %}
call:
<ul class="main-menu">
{{ macros.menu_links(links) }}
</ul>
What approach would have a better performance?