Cache results in _drupalorg_testing_get_tid_by_term()
dww - October 12, 2008 - 05:24
| Project: | Drupal.org Testing |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | aclight |
| Status: | closed |
Description
I noticed this while reviewing the latest patch for #231640: Auto-generate some release nodes:
Neither _drupalorg_testing_get_tid_by_term() nor taxonomy_get_term_by_name() cache their results.
_drupalorg_testing_get_tid_by_term() is called in a nested foreach loop when generating release nodes, and therefore, we're doing A LOT of duplicate queries.
Yes, it's an install profile, so we don't really care about performance that much, but we don't need to ruthlessly pound the DB for nothing. ;) Think of the kittens on shared hosting test sites that might get in trouble with bogus queries/second quotas and the like...

#1
Ok, here we go. By my count, this saves 318 db queries over multiple seconds. Probably not that big of a deal, but maybe in the future when this profile has 1000 projects in it the savings will become significant. :)
#2
Perfect, thanks.
#3
Committed to HEAD
http://drupal.org/cvs?commit=145978
#4
Automatically closed -- issue fixed for two weeks with no activity.