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...

CommentFileSizeAuthor
#1 320150_dot_cache_tids.patch1.24 KBaclight

Comments

aclight’s picture

Assigned: Unassigned » aclight
Status: Active » Needs review
StatusFileSize
new1.24 KB

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. :)

dww’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, thanks.

aclight’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.