WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34488 closed enhancement (fixed)

REST API: Save some preg_match iterations

Reported by: TobiasBg Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords: has-patch needs-testing
Focuses: Cc:
PR Number:

Description

In the WP_REST_Server, a preg_match call and an if-check can be moved one level of for-loops up.

It doesn't depend on the $handler variable nor is it modified in the inner for-loop, so that this would save some preg_match/REGEXP iterations.

Also see https://wordpress.slack.com/archives/core-restapi/p1446136013000935.

Attachments (1)

34488.diff (967 bytes) - added by TobiasBg 4 years ago.

Download all attachments as: .zip

Change History (3)

@TobiasBg
4 years ago

#1 @johnbillion
4 years ago

  • Keywords needs-testing added

#2 @wonderboymusic
4 years ago

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

In 35514:

REST API: in WP_REST_Server::dispatch(), move preg_match() out of it's current loop, which doesn't affect the context passed to it.

Props TobiasBg.
Fixes #34488.

Note: See TracTickets for help on using tickets.