# Recursive get\_section() performance

**URL:** <https://zola.discourse.group/t/recursive-get-section-performance/2247>\
**Category:** Support\
**Created:** [August 3, 2024, 8:45pm UTC](https://zola.discourse.group/t/recursive-get-section-performance/2247 "2024-08-03T20:45:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![harryob](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/harryob/32/1281_2.png) [@harryob](https://zola.discourse.group/u/harryob)\
**Post date:** [August 3, 2024, 8:45pm UTC](https://zola.discourse.group/t/recursive-get-section-performance/2247/1 "2024-08-03T20:45:39Z")

</div>

Hi! For a site I’m currently making, I’m attempting to make a sidebar navigation window that will display _every_ page recursively through subsections. There’s roughly 28 subsections to iterate through, and 650~ pages on the site in total. However, using `get_section()` to get the subsections of sections (and not being able to use `metadata_only`, as this will prevent the `pages` field being populated) dramatically slows down site rendering (bringing it up to roughly 28 seconds).

I was wondering if there was a different way of being able to iterate through every page in a site that I’m overlooking, or if there’s a way to eek out some extra performance here.

The lines in question are here - there’s a lot of extraneous code that I’m yet to tidy up, but the performance-eating line in question is L64.

> <https://github.com/harryob/od-dm-reference/blob/ad87bdc6bac3020643f8ed35a9bd781a9f7187ad/templates/macros.html#L3-L78>

Thank you!
