WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#2463 closed defect (bug) (fixed)

get_permalink() performance improvement

Reported by: arnee Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 1.5.2
Component: Optimization Keywords: bg|has-patch
Focuses: Cc:

Description

template-functions-links.php

Change the get_permalink() function from:

		$rewritereplace = 
		array(
			date('Y', $unixtime),
			date('m', $unixtime),
			date('d', $unixtime),
			date('H', $unixtime),
			date('i', $unixtime),
			date('s', $unixtime),
			$post->post_name,
			$post->ID,
			$category,
			$author,
			$post->post_name,
		);

to:

		$date = explode(" ",date('Y m d H i s', $unixtime));
		$rewritereplace = 
		array(
			$date[0],
			$date[1],
			$date[2],
			$date[3],
			$date[4],
			$date[5],
			$post->post_name,
			$post->ID,
			$category,
			$author,
			$post->post_name,
		);

This will speed up the function by 50 percent. This is a enormous value if you have to generate permalinks for all of your posts. I hope this will be added to the next release.

Attachments (1)

2463.diff (755 bytes) - added by szepter 11 years ago.
get_permalink code optimization

Download all attachments as: .zip

Change History (10)

#1 @arnee
11 years ago

  • Keywords bg|needs-testing bg|needs-patch added

#2 @arnee
11 years ago

  • Version changed from 1.2 to 1.5.2

@szepter
11 years ago

get_permalink code optimization

#3 @szepter
11 years ago

  • Keywords bg|has-patch added; bg|needs-patch removed

#4 @ryan
11 years ago

  • Milestone set to 2.1
  • Owner changed from anonymous to ryan

#5 @ryan
11 years ago

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

(In [3538]) get_permalink() performance improvement from arnee. fixes #2463

#6 @arnee
11 years ago

  • Keywords bg|needs-testing removed

#7 @ryan
11 years ago

  • Resolution set to fixed

(In [3823]) get_permalink() performance improvement from arnee. fixes #2463

#8 @ryan
11 years ago

  • Milestone changed from 2.1 to 2.0.3

#9 @anonymous
10 years ago

  • Milestone 2.0.3 deleted

Milestone 2.0.3 deleted

Note: See TracTickets for help on using tickets.