Make WordPress Core

Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#10357 closed enhancement (invalid)

Use strtr() when possible

Reported by: scribu's profile scribu Owned by: scribu's profile scribu
Milestone: Priority: low
Severity: normal Version:
Component: Optimization Keywords: has-patch close
Focuses: Cc:

Description

When replacing strings of the same lenght, it's better to use strtr() instead of str_replace() because it's faster.

Attachments (1)

strtr.patch (5.5 KB) - added by scribu 16 years ago.
use strtr() for single character replacements

Download all attachments as: .zip

Change History (6)

@scribu
16 years ago

use strtr() for single character replacements

#1 @azaozz
16 years ago

There are conflicting reports on which is faster, seems strtr() is a little faster only for very short strings but the difference is less than a microsecond.

#2 @Denis-de-Bernardy
16 years ago

  • Keywords close added

let's close then?

#3 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Optimization
  • Milestone changed from 2.8.2 to 2.9

#4 @scribu
15 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I guess it's not worth the trouble.

#5 @scribu
15 years ago

  • Milestone 2.9 deleted
Note: See TracTickets for help on using tickets.