Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Special case mktime: semi-sequential access

by CountZero (Bishop)
on Jul 01, 2013 at 13:54 UTC ( [id://1041861]=note: print w/replies, xml ) Need Help??


in reply to Special case mktime: semi-sequential access

I think memoizing is something to look into, but you will have to split the time-calculations into the date part and the time part. If you calculate and memoize the value for the date at 00:00 hour then you will benefit even if the dates are not sequential and you save yourself the burden of checking whether the date is indeed within the same day. One out of sequence log entry will "destroy" your cache, whereas memoize will not be bothered.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1041861]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-03-19 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found