Patch #3225

Date::span() performance patch

Added by Leonard Fischer almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:09/05/2010
Priority:LowDue date:
Assignee:Woody Gilk% Done:

0%

Category:CoreEstimated time:0.25 hour
Target version:v3.0.8
Resolution:wontfix Points:

Description

The Date::span method uses a regex to split the severel output-types:

// Array with the output formats
$output = preg_split('/[^a-z]+/', $output);

Changing the "preg_split" to "explode" gives a performance boost about 23% (via Codebench)

// Array with the output formats
$output = explode(',', $output);

I'm not sure if the regex had a deeper meaning, maybe it's necessary... But in my testcases everything just worked fine!
Sorry for my bad english, just trying to help ;)

History

#1 Updated by Woody Gilk almost 4 years ago

  • Status changed from New to Feedback
  • Target version set to v3.0.8

The regex accounts for any separator, such as years months days. Your patch would only allow commas to be used.

#2 Updated by Leonard Fischer almost 4 years ago

Yeah, that's right.
I looked at the default values and optimized the method for using those. I think it's no problem if this patch won't get into the next version of Kohana :) It's your turn to decide if comfort > performance
Greetings from germany

#3 Updated by Woody Gilk almost 4 years ago

  • Status changed from Feedback to Closed
  • Resolution set to wontfix

Also available in: Atom PDF