A more economical method of building an archive menu? I seem to be having trouble with the performance of my site (on localhost) after including this object. Im using it to build a menu for an archive of the posts section which has about 2,500 entries inside of it. 

{% set allEntries = craft.entries.section('posts').limit(null) %}

{% for year, entriesInYear in allEntries | group("postDate.year") %}
    {{ year }}
{% endfor %}


This fetch request spits out the following:


  2016 2015 2014 2013 2012 2011 2010 2009


When I make this fetch request, my page is reload time is ~11s. If I comment out this request my page reload time is ~3s. 

Is there a more economical way to return the years associated with my posts?
If you know which years should appear, and there are no breaks in the timeline, perhaps it would make more sense to do a simple numeric loop instead...

{% for year in (now.year)..2009 %}
    {{ year }}
{% endfor %}


That will count backwards from the current year to 2009.