Sunday, July 22, 2012

Re: Change created/modified to unix time

for standards it doesnt matter which country you come from - praise the lord.
on a db level this usually only is the one: YY-MM-DDDD (for the reasons mentioned above)

you are worried about a theoretical - slightly - slower performance with the current way of doing things?
write a test case to prove it - with a lot of loops you might actually see a difference. But I doubt it will be meaningful.
you will most certainly find out that the performance gain - if measurable at all - stands in no comparison to other things in the whole framework dispatching process.
meaning: if the whole process needs 1.5 seconds (request till display) and you search in the DB takes 0.2 than 0.15 wouldnt make much of a difference.

wrong bottleneck to work on at the moment - just my 5 cents
caching and other more practical things will make more of a difference in the long run.



Am Sonntag, 22. Juli 2012 21:36:39 UTC+2 schrieb Alex:
Where are you doing these searches? If in the database I don't think
there would be much of a performance hit.

The searches are within the database yes, the problem is that "not much of a performance hit" isn't ideal when carrying out a large number of searches.
 

You could do a conversion in AppModel::afterFind and add a new key,
'timestamp' to the data for each record. Or you could even have the
database include it in the results for you, for that matter.

Converting it after performing the search wouldn't help the performance of the search unfortunately.
 

> I realise there may be the excuse that formatting would be required as unix
> timestamps are unreadable, but this is also the case with the current setup
> as how many people use YYYY-MM-DD HH:MM:SS when displaying dates? it's
> usually DD-MM-YYYY or MM-DD-YYYY.

No it's not usually those formats. YYYY-MM-DD is an ISO standard for
good reason. It sorts naturally, for one thing. Another obvious reason
is right there in your comment: "DD-MM-YYYY or MM-DD-YYYY" Yes? Which
is it then? They're ambiguous, so should be avoided.

Sorry by usually I'm referring to US/UK, I have a slight bias :)
 

Now, if only some countries would also adopt the metric system. ;-)

> What does everyone else think?
>
> Is there a way to convert the current created/modified fields to UNIX
> timestamps with current CakePHP?

I'll leave it for someone else to say. I know that I have seen where
that is set but cannot remember now.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate