WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#34121 closed enhancement (fixed)

Add PCRE Performance Testing

Reported by: miqrogroove Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

The script I've been using for PCRE performance testing is now getting released as a phpUnit utility. Details to follow...

Attachments (3)

34121.diff (117.1 KB) - added by miqrogroove 5 years ago.
34121.2.diff (2.3 KB) - added by miqrogroove 5 years ago.
Missing parts
34121.3.diff (2.5 KB) - added by miqrogroove 5 years ago.

Download all attachments as: .zip

Change History (9)

@miqrogroove
5 years ago

#1 @miqrogroove
5 years ago

  • Keywords has-patch added

In 34121.diff:

  • Move pattern from wptexturize() into a separate function.
  • Move pattern from wp_html_split() into a separate function.
  • Beautify code for wp_html_split().
  • Remove unnecessary instances of /s modifier in patterns that don't use dots.
  • Add tests/phpunit/data/formatting/whole-posts.php for testing larger strings.
  • Add function benchmark_pcre_backtracking().
  • Add tests for wp_html_split().
  • Add tests for wptexturize().
  • Add tests for get_shortcode_regex().

#2 @wonderboymusic
5 years ago

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

In 34761:

Shortcodes/Formatting: Add PCRE Performance Testing

  • Move pattern from wptexturize() into a separate function.
  • Move pattern from wp_html_split() into a separate function.
  • Beautify code for wp_html_split().
  • Remove unnecessary instances of /s modifier in patterns that don't use dots.
  • Add tests/phpunit/data/formatting/whole-posts.php for testing larger strings.
  • Add function benchmark_pcre_backtracking().
  • Add tests for wp_html_split().
  • Add tests for wptexturize().
  • Add tests for get_shortcode_regex().

Props miqrogroove.
Fixes #34121.

#3 @miqrogroove
5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Looks like we missed a file there :) I want to tweak the new benchmark function anyway so patch coming up briefly.

@miqrogroove
5 years ago

Missing parts

@miqrogroove
5 years ago

#4 @boonebgorges
5 years ago

In 34772:

Fix preg_match_all() syntax in PCRE benchmark test util.

In versions of PHP earlier than 5.4, the $matches parameter was required.
Excluding it here meant that PCRE benchmarking tests were erroring on older
versions of PHP without cleaning up the PCRE ini settings, causing various
problems on later tests.

Props miqrogroove, dd32, boonebgorges.

And to the cosmic forces that cause bugs like this. The best part of waking up
is diagnosing leakage between automated tests.

See #34121.

#5 @boonebgorges
5 years ago

In 34773:

Improvements to PCRE benchmarking tests.

  • Add test file accidentally omitted from [34761].
  • Bail properly from benchmarker when a preg_last_error() is found.

Props miqrogroove.
See #34121.

#6 @miqrogroove
5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed by [34761], [34772], and [34773]

Note: See TracTickets for help on using tickets.