Ticket #2548 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

ent2ncr is very, very slow

Reported by: random Assigned to: 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

ent2ncr.diff (472 bytes) - added by random on 03/09/06 10:42:06.

Change History

03/09/06 10:42:06 changed by random

  • attachment ent2ncr.diff added.

03/09/06 11:12:39 changed by skeltoac

Looks great!

03/09/06 11:14:52 changed by davidhouse

  • keywords set to bg|has-patch.

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.

03/10/06 00:41:20 changed by markjaquith

  • owner changed from anonymous to markjaquith.
  • status changed from new to assigned.

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

03/14/06 02:48:39 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

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

04/22/06 00:08:02 changed by ryan

  • milestone changed from 2.1 to 2.0.3.

Reopen for 2.0.3 inclusion.

04/22/06 00:11:11 changed by ryan

  • status changed from closed to closed.
  • resolution set to fixed.

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

11/30/06 19:41:50 changed by

  • milestone deleted.

Milestone 2.0.3 deleted