WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2548 closed enhancement (fixed)

ent2ncr is very, very slow

Reported by: random Owned by: markjaquith
Priority: low Milestone:
Component: Optimization Version: 2.0.1
Severity: normal Keywords: bg|has-patch
Cc:

Description

I was playing with a profiler this afternoon, and was surprised to see that 10% of the request execution time was being spent on ent2ncr(). That's incredibly high.

The patch I'm about to attach replaces the 250+ str_replace() calls with a single one, which seems to be around 5-30x faster in real-world situations. The speed difference decreases as the length of text parsed increases. It was just a bit ahead at ~40,000 words of text, and the profiler choked on anything more.

Attachments (1)

ent2ncr.diff (472 bytes) - added by random 7 years ago.

Download all attachments as: .zip

Change History (8)

random7 years ago

comment:1 skeltoac7 years ago

Looks great!

comment:2 davidhouse7 years ago

  • Keywords bg|has-patch added

Yeah, nicely spotted. I doubt anyone will be publishing 40,000 word essays, so your patch looks brilliant. When I get home I'll test the patch then bg|commit it, if no-one else has done already.

comment:3 markjaquith7 years ago

  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Love it. Applied it and haven't noticed any problems.

comment:4 ryan7 years ago

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

(In [3641]) ent2ncr optimization. Props random. fixes #2548

comment:5 ryan7 years ago

  • Milestone changed from 2.1 to 2.0.3

Reopen for 2.0.3 inclusion.

comment:6 ryan7 years ago

  • Resolution set to fixed

(In [3742]) ent2ncr optimization. Props random. fixes #2548

comment:7 anonymous7 years ago

  • Milestone 2.0.3 deleted

Milestone 2.0.3 deleted

Note: See TracTickets for help on using tickets.