Re: [SMARTY] MD5
| From: | Monte Ohrt | Date: | Thu, 06 Jun 2002 13:21:42 +0000 |
| Subject: | Re: [SMARTY] MD5 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4653@lists.php.net to get a copy of this message | ||
That would be faster, although this only happens at compile time so it's probably not a noticable performance issue.
Jan Rosier wrote:
This gave my an idea. To speed up things, why not just always prepend a letter T (of template ;-) ). I try this in Smarty. Works and saves 3 str_replace Greetz, Jan Rosier ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "Matt Berg" <mberg@inspidered.com> Cc: "Andrei Zmievski" <andrei@ispi.net>; <smarty-general@lists.php.net> Sent: Wednesday, June 05, 2002 6:55 PM Subject: Re: [SMARTY] MD5-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.fyi, crc32 can create negative numbers. Although starting filenames/dirnames with "-" seems to work in Solaris/Linux, I'm not sure how other OS's might behave, so we replace the "-" with an "N" to be safe. Matt Berg wrote:http://www.gravitonic.com/Thanks. I was unaware of crc32 which should be perfect since I plan on using in a similar fashion to the way you name your compiled templates. Matt Andrei Zmievski wrote:On Wed, 05 Jun 2002, Monte Ohrt wrote:We switched everything internal to Smarty to use crc32 instead, it is ~10 times faster. It may or may not suit your needs.Yes, but while crc32 fits our needs, md5() is a much more robust algorithm. -Andrei-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ------------------------------------------------------------------------ 1391,1393c1391,1395* It said 'Winmodem' on the box, but I still feel like I lost. *< $source_hash = 'T' . crc32($auto_source); < return $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . < $source_hash . DIR_SEP . 'T' . crc32($auto_id) . '.php';---1412,1413c1414,1415$source_hash = str_replace('-','N',crc32($auto_source)); $res = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash . DIR_SEP . str_replace('-','N',crc32($auto_id)) . '.php';return $res;< $source_hash = 'T' . crc32($auto_source); < $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . $source_hash;---$source_hash = str_replace('-','N',crc32($auto_source)); $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash;