Patch #3225
Date::span() performance patch
| Status: | Closed | Start date: | 09/05/2010 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | Core | |||
| Target version: | v3.0.8 | Estimated time: | 0.25 hour | |
| 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
Updated by Woody Gilk over 2 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.
Updated by Leonard Fischer over 2 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
Updated by Woody Gilk over 2 years ago
- Status changed from Feedback to Closed
- Resolution set to wontfix