Closed (fixed)
Project:
Office Hours
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Apr 2013 at 10:18 UTC
Updated:
27 May 2013 at 19:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
oxyc commentedI haven't tested this in production yet and I don't know if this will be enough but at least it's a good start.
This patch statically caches the object creation per time integer. Additionally it caches the current time across a page request so nothing unwanted happens. I'm far from familiar with date logic so someone with more experience should definitely RTBC this, it might need some more work.
XHPRof for a request displaying 3 entities with office hours.
Before:

After:

Comment #2
oxyc commentedComment #3
johnvWhat are your figures when using this version (removing the expensive DateTime class alltogether)?
Comment #4
oxyc commentedSorry for taking so long in testing this! I appreciate you looking into it.
Single entity with office hours:
Original:
Total Incl. Wall Time (microsec): 749,925 microsecs
Total Incl. CPU (microsecs): 740,046 microsecs
Total Incl. MemUse (bytes): 85,551,696 bytes
Total Incl. PeakMemUse (bytes): 85,807,080 bytes
Number of Function Calls: 41,050
Patch from #1:
Total Incl. Wall Time (microsec): 673,621 microsecs
Total Incl. CPU (microsecs): 668,041 microsecs
Total Incl. MemUse (bytes): 85,601,408 bytes
Total Incl. PeakMemUse (bytes): 85,857,312 bytes
Number of Function Calls: 34,946
Patch from #3:
Total Incl. Wall Time (microsec): 622,382 microsecs
Total Incl. CPU (microsecs): 616,039 microsecs
Total Incl. MemUse (bytes): 85,381,328 bytes
Total Incl. PeakMemUse (bytes): 85,636,736 bytes
Number of Function Calls: 32,853
10 entities with office hours (all displaying the exact same hours):
Original:
Total Incl. Wall Time (microsec): 1,938,972 microsecs
Total Incl. CPU (microsecs): 1,920,121 microsecs
Total Incl. MemUse (bytes): 111,618,320 bytes
Total Incl. PeakMemUse (bytes): 112,303,584 bytes
Number of Function Calls: 183,432
Patch from #1:
Total Incl. Wall Time (microsec): 1,418,715 microsecs
Total Incl. CPU (microsecs): 1,364,086 microsecs
Total Incl. MemUse (bytes): 111,646,480 bytes
Total Incl. PeakMemUse (bytes): 112,332,112 bytes
Number of Function Calls: 103,771
Patch from #3:
Total Incl. Wall Time (microsec): 1,296,370 microsecs
Total Incl. CPU (microsecs): 1,280,080 microsecs
Total Incl. MemUse (bytes): 111,457,936 bytes
Total Incl. PeakMemUse (bytes): 112,142,336 bytes
Number of Function Calls: 101,462
Just for frame of reference, not displaying the office hours field on the 10 entities:
Total Incl. Wall Time (microsec): 1,296,770 microsecs
Total Incl. CPU (microsecs): 1,280,080 microsecs
Total Incl. MemUse (bytes): 111,273,056 bytes
Total Incl. PeakMemUse (bytes): 111,928,064 bytes
Number of Function Calls: 97,569
Comment #5
johnvCool! Thanks for testing and your ideas! I'll add #3 shortly.
Comment #6
johnvCommitted here.
Comment #7.0
(not verified) commentedAdded actual description