Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP Array speed restrictions

Options
  • 10-11-2005 2:50pm
    #1
    Closed Accounts Posts: 53 ✭✭


    When dealing with large arrays (40k entires, 1-2 values off an index) just wondering if the time is in PHP creating the array and\or reading from it?
    Just considering putting the data from the array into a include that gets recached when needed via a cron \ update check page but if PHP is going to have a problem dealing when I include that when needed its probably not worth it and I'd be better off joining the additional data in.
    Trying to stop a few joins though as one of my rapid queries dies to .5-2s exec times when joining two fairly large (cum. 100mb?) tables to get additional needed data.

    Thanks!


Comments

  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    echo a timestamp before and after each step to get it's duration, should get you some useful info at least


  • Closed Accounts Posts: 53 ✭✭jc94062


    Thanks.
    Tried time() without luck, was getting either 1s or 0s so went down the gettimeofday method and got

    Time 1: 1.131790514113E+15
    Time 2: 1.1317905146141E+15
    Time Difference: 0.501052

    Thats for 40k rows and 1.x mb (using a 2char array name, can't get much shorter!)

    Just for future reference for people, I did some testing...
    File sizes are in kb, time. diffs calc'ed to seconds.

    1092.6 - Time Difference: 0.501052
    136.8k - Time Difference: 0.077879
    68.4k - Time Difference: 0.038649
    136.8k - Time Difference: 0.077879
    6.2k - Time Difference: 0.002762
    5k - Time Difference: 0.002362
    2k - Time Difference: 0.001184

    I put this into excel and got this

    KB Seconds Secs per KB

    2 0.001184 0.000592

    5 0.002362 0.0004724

    6.2 0.002762 0.000445484

    68.4 0.038649 0.000565044

    136.8 0.077879 0.000569291

    1092.6 0.501052 0.000458587

    So 0.0005 (0.5milli secs) per KB.
    Or in other words 0.5micro secs per byte\character.

    Although this will likely differ greatly between systems its at least an idea.


Advertisement