Which means drupal_static() gets called about 130 additional times on a standard front page with ten nodes. Attached profiling output.

Comments

yched’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. Should we add a comment on those 'advanced drupal_static() pattern', or are they considered standard already ?

catch’s picture

There's a big phpdoc hunk in drupal_static() which went in with the original patch, the hope is that people look there when they see the weirdness.

effulgentsia’s picture

Just my $0.02, but I would really like to see #619666: Make performance-critical usage of drupal_static() grokkable land first, and this be re-rolled with that change. The other uses of the advanced pattern currently in HEAD do not pass a default to drupal_static(), and one reason I rolled the patch that introduced the advanced pattern that way is because that middle line is so long and obscure that I thought it would be better DX to have it always be identical everywhere it's used. However, I think the cleanup patch in that issue makes the line sufficiently more grokkable that having a use-case like this that passes a default to drupal_static() is ok (with only one use of __FUNCTION__ in that line of code, it's recognizable what the parameter after it means).

Also, I'd encourage adding the 1-line comment to this patch (copy it from other uses). But I also wonder if we want to change that comment line to something else, maybe something that includes an @see drupal_static() directive. That's not for this issue, but the fact that this patch was rolled without including that 1-line comment makes me realize that the comment isn't sufficiently clear and/or useful.

catch’s picture

Status: Reviewed & tested by the community » Postponed

I've just marked the other one RTBC, postponing this.

effulgentsia’s picture

Status: Postponed » Needs work

The other one landed. Please re-roll and add comment.

mgifford’s picture

Status: Needs work » Needs review
Issue tags: -Performance

drupal_static_fields.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Performance

The last submitted patch, drupal_static_fields.patch, failed testing.

swentel’s picture

Version: 7.x-dev » 8.x-dev

Still needed for D8 ?

swentel’s picture

Status: Needs work » Closed (fixed)

Hmm apparently not, looks like this has been handled in separate commits, for both D8 and D7.