> Which (if either) of the following 2 snips of code are more efficient and
> faster to parse?
>
> Snip 1.
>  print("</TD>\n");
>  print("</TR>\n");
>  print("</TABLE>\n");
>
> Snip 2.
>  print("</TD></TR></TABLE>\n");

#2 will be faster, but the difference is very, very small.  You should prove
it to yourself by writing a small test script like this:

<?
        print(microtime() . "<br>");
        for($i=0; $i<10000; $i++)
        {
                print("1");
                print("2");
                print("3<br>\n");
        }
        print(microtime() . "<br>");
        for($i=0; $i<10000; $i++)
        {
                print("123<br>\n");
        }
        print(microtime() . "<br>");
?>

This gives me 0.88831700 970687237,  0.04122700 970687239, and 0.42651200
970687240.
So, the first version takes about 1.8 seconds.  The second takes about 1.4
seconds.
(Check my math :)
That's 10,000 lines of HTML.  (Oh yeah...and I did this on a PHP 3 box).
PHP 4
should be even less of a difference.  It would be insteresting to see what
performance
you're getting on your box.

Leon







------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to