Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: php performance

  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php performance

    how can i measure the speed of the performance of php?

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    by inserting a timer. example
    PHP Code:
    //first a little function to compute the elapsed time
    function microtime_diff($a$b) {
       list(
    $a_dec$a_sec) = explode(" "$a);
       list(
    $b_dec$b_sec) = explode(" "$b);
       return 
    $b_sec $a_sec $b_dec $a_dec;
    }
    //then insert this at the startpoint
    $start_time microtime();
    //then your code you wan't to clock
    for ($i 0$i<=100000$i++){}
    // then the endpoint and print
    $duration microtime_diff($start_timemicrotime());
    echo (
    '100 000 incrementations took ' sprintf("%0.3f"$duration) . ' seconds'); 
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •