Date::span() performance patch
|Assignee:||Woody Gilk||% Done:||
|Target version:||v3.0.8||Estimated time:||0.25 hour|
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 ;)
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