Minor optimization of theme(); prevent calling include_once multiple times when calling a theme function multiple times.

CommentFileSizeAuthor
theme.patch633 bytescasey

Comments

casey’s picture

Issue tags: +Performance

Probably not very much.

moshe weitzman’s picture

Status: Needs review » Closed (won't fix)

The unset could potentially outweight the cost of include_once. Remember those include_once calls operate on an absolute path so they are quick. Reopen if you ever make benchmarks for this.

casey’s picture

I am ok with the won't fix, but an unset outweighting include_once...

catch’s picture

Status: Closed (won't fix) » Needs review

Needs benchmarks means it needs review, not that it's won't fix.

dries’s picture

We have a tag for that!

effulgentsia’s picture

Title: Minor optimization of theme() » Minor optimization of theme() for lazy loaded theme functions

Subscribing. My hunch is it's a small net improvement, because the penalty of an unset would only be paid once per theme hook, so I can't imagine any page where it would be detectable, and the savings would be had on every invocation of a theme hook (after the 1st one), so at least in theory, that could add up to something measurable. The question is: is there a use-case of a theme hook that has a 'includes' that is called enough times per page request for the savings to be worth the extra line of code (or perhaps more to the point, worth someone's time to generate the benchmarks and drive the issue along).

catch’s picture

theme.patch queued for re-testing.

xjm’s picture

Issue tags: +needs profiling
joelpittet’s picture

Issue summary: View changes

Hmm tried to benchmark this but couldn't apply and after fuzzing it I got a bunch of errors. I'd consider a won't fix too.

Notice: Indirect modification of overloaded element of ThemeRegistry has no effect in theme() (line 1068 of includes/theme.inc).

catch’s picture

Status: Needs review » Closed (won't fix)

Yep. 2010 is a long time ago.