WordPress.org

Make WordPress Core

#21422 closed enhancement (fixed)

Micro-optimization in admin-footer.php

Reported by: TobiasBg Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: trivial Version: 3.3
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

After some work (related to the admin bar) on admin-footer.php in wp-admin a while ago ([18888], the latest change in the file), the file does some unnecessary stuff, like an implode() on a one-item array, that's constant and unchangable.

It's just minor, but still done on every page load in the Dashboard, so let's just micro-optimize it away.

The attached patch removes that unnecessary implode() and two local variables.

Attachments (1)

admin-footer-micro-optimization.patch (1.0 KB) - added by TobiasBg 21 months ago.
Patch to remove unnecessary implode() call and two local variables

Download all attachments as: .zip

Change History (4)

TobiasBg21 months ago

Patch to remove unnecessary implode() call and two local variables

comment:1 SergeyBiryukov21 months ago

  • Component changed from General to Administration
  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.5
  • Severity changed from normal to trivial

comment:2 nacin21 months ago

There used to be other members of the array here.

I don't really like "micro-optimization" arguments, but this can be argued for much simpler reasons: It improves code readability.

(And, often, code readability goes against what could be considered a "micro-optimization" — in those cases, readability should take precedence. In this case, they are on the same side.)

comment:3 nacin21 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21366]:

Improve code readability and execution in admin-footer by removing a now-unnecessary implode(). props TobiasBg, fixes #21422.

Note: See TracTickets for help on using tickets.