Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21422 closed enhancement (fixed)

Micro-optimization in admin-footer.php

Reported by: tobiasbg's profile TobiasBg Owned by: nacin's profile 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 12 years ago.
Patch to remove unnecessary implode() call and two local variables

Download all attachments as: .zip

Change History (4)

@TobiasBg
12 years ago

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

#1 @SergeyBiryukov
12 years ago

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

#2 @nacin
12 years 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.)

#3 @nacin
12 years 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.