Re: 2 questions about performance...

From: Date: Tue, 06 Mar 2001 22:28:42 +0000
Subject: Re: 2 questions about performance...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42833@lists.php.net to get a copy of this message
simplest answer is find out yourself. every machine will depending on config and hardware will be difffernet. <?php function mtime() { $mtime = microtime(); $mtime = str_replace('.', '', $mtime); $mtime = explode(' ', $mtime); $mtime = $mtime[1] . $mtime[0]; return($mtime); } class debug { function debug() { $this->start = mtime(); } function reset() { $all_vars = get_object_vars($this); foreach($all_vars as $pos => $val) if ($pos != 'error') unset($this->$pos); } function time($text = '') { $this->break = mtime(); $time = ($this->break - $this->start) / 1000000000; echo number_format($time, 4) .' '. $text ."<br>\n"; $this->start = $this->break; } } $debug = new debug; //------------------------------------------------------------------- $debug->time('start'); // code snippit $debug->time('end'); ?> works great or me. you can find out exactly where your code is slowing you down, only thing is now to find out how to improve that :) -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 lee@mediawaveonline.com ""Joe Sheble (Wizaerd)"" <JustForMailingLists@wizaerd.com> wrote in message news:NEBBJIOOOLABHKDFACGHKEEPDMAA.JustForMailingLists@wizaerd.com... Is it in-efficient to use shuffle()? I have a simple 6 element array with 6 strings (URLs to images) and I'm using shuffle() to display all of them in random order upon each page load. The images take a long time (of course is relative, it's mere seconds) but when I remove the call to shuffle, they appear much much faster... Also, is there an efficient number or limit of queries one should call in a singular PHP page? On average, I'll make 7-10 seperate queries to display a page (a graphics related portal and content management system)... I have a singular database connection (with mysql_pconnect()) and use that same connection throughout the script. Sometimes it appears to load quickly, than other times it doesn't, and I'm afraid that as more and more content get put into the databases, the slower it will perform. user authentication navigation (link definitions) form dropdowns (dynamic selects) banner rotation (2 sets, big and small) activity tracker headline or story retrieval comments Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#42833) next »