Performance concerns: index.php vs taxonomy-$taxonomy.php

TL;DR Template: Performance not so much, semantics however, use hierarchy!

TL;DR Query String: Use provided hooks, never edit directly.

The Template File

Apart from performance, first look at semantics. If you direct your browser to a taxonomy archive, WordPress will look for the following files (straight from the Codex):

  1. taxonomy-{taxonomy}-{term}.php – If the taxonomy were sometax, and taxonomy’s term were someterm WordPress would look for taxonomy-sometax-someterm.php. In the case of Post Formats, the taxonomy is 'post_format' and the terms are 'post-format-{format}'. i.e. taxonomy-post_format-post-format-link.php
  2. taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php
  3. taxonomy.php
  4. archive.php
  5. index.php

So it seems WordPress has a system to handle your challenge. The question is, if WordPress provides an internal fallback template hierarchy system where taxonomy.php could be used to display all taxonomy pages and taxonomy-{taxonomy}.php displays that specific taxonomy.

You are creating this for just yourself? Use whatever you like. The lookup system is quite fast so don’t worry about performance. The conditional tags are pretty quick as well. But you probably are not. Let’s see why not to use index.php:

  • WordPress provides functionality to display taxonomies.
  • WordPress already queries for taxonomies, so why re-query it because you want to use a page initially not designed for taxonomies?
  • Someone else might look over the code, needing to look up 1, 2, 3 and 4 of the hierarchy before realising the code is in index.php. That someone might be you after a decent amount of time.
  • Clutters index.php unnecessarily.
  • You don’t need to customize the loop in taxonomy.php.

The Query String

Never change the query string directly, but use the hooks provided to change the query string such as pre_get_posts. The Codex page is quite extensive. All related hooks are listed as well (such as join statements and order statements). Just never change the loop directly. Why? Because WordPress provides. Plugins might hook into this too and several other reasons.