Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#38514 closed enhancement (fixed)

Comment form performs a lot of unused logic when not open for comments

Reported by: jipmoors Owned by: SergeyBiryukov
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Comments Keywords: has-patch
Focuses: performance Cc:


The comment_form function performs a lot of data preparation and logic, but when the current object is closed for comments it will not use anything and just trigger an action.

Suggesting to move the check to the start of the function, thus reducing complexity and increasing performance.

Attachments (1)

comment_form-early_exit.diff (13.0 KB) - added by jipmoors 5 years ago.

Download all attachments as: .zip

Change History (4)

#1 @jipmoors
5 years ago

I was confused by the diff because everything has been shifted. It looks like a lot of changes but it's just an indentation change.

Last edited 5 years ago by jipmoors (previous) (diff)

#2 @SergeyBiryukov
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.7

#3 @SergeyBiryukov
5 years ago

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

In 38959:

Comments: In comment_form(), bail early if comments for the post are closed.

Props jipmoors.
Fixes #38514.

Note: See TracTickets for help on using tickets.