Download & Extend

Optimize date_has_time and date_has_date

Project:Date
Version:7.x-2.x-dev
Component:Date API
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Some small tweaks to date_has_time and date_has_date to speed things up a bit.

Basically, return early when granularity isn't an array.

Second, use isset instead of array_intersect with count and a typecast.

I've included an XHProf showing the performance difference for date_has_time. A similar savings is gained from date_has_date.

AttachmentSizeStatusTest resultOperations
date_has_time original.png96.42 KBIgnoredNoneNone
date_has_time isset.png81.03 KBIgnoredNoneNone

Comments

#1

Patch with optimizations.

AttachmentSizeStatusTest resultOperations
1933606-optimize-date_hast_time-date.patch941 bytesTest request sentNoneView details

#2

Status:active» needs review