Re: convert numerical day of week

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/22/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
No, your solution is bloated. Mine may run a tad slower,

Two function calls wrapped in a function will be slower.  Tad or a
lot, slower is still slower.

but it consumes
less memory since it uses the weekday names already defined in the
locale.

Looks to me like your version consumes more memory:

ps aux|grep php
destiney  9448   0.0 -0.2    72596   4760  p2  S+    4:40PM   0:00.03
php simple.php
destiney  9449   0.0 -0.2    72596   4852  p1  S+    4:40PM   0:00.03
php locale.php

Yours redefines the strings thus requiring that much extra
storage. Yours is redundant with information already available in the
locale.

You're specializing for an edge case before you even know if you need
to or not.  As I've shown above memory is saved by defining your own
list of days.  I'm sure given the right conditions your function would
be of great use.  Maybe later on someone will actually ask about
locales, then you can repost it and it can become relevant.

The YAGNI claim is irrelevant here since I'm producing the
requested functionality that the poster obviously needs. Whether I use
your method or my method is irrelevant to YAGNI.

I'm looking at the original post and I still can't seem to find
anything about locales in there.  Locales only came into the thread
when you posted your function.

Thank you, try again.

My solution stands as the best one, for memory usage and speed.
Please benchmark it so you will learn from this experience.


--
Greg Donald
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux