Make WordPress Core

Opened 10 years ago

Closed 10 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
Priority: normal Milestone: 4.7
Component: Comments Version: 4.7
Severity: normal Keywords: has-patch
Cc: Focuses: performance

Description

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 10 years ago.

Download all attachments as: .zip

Change History (4)

#1 @jipmoors
10 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 10 years ago by jipmoors (previous) (diff)

#2 @SergeyBiryukov
10 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review4.7

#3 @SergeyBiryukov
10 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

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.