Search Results

Search found 1 results on 1 pages for 'pawpro'.

Page 1/1 | 1 

  • Why is this loop over mysql resultset slow? (1.4ms per cycle)

    - by pawpro
    The $res contains around 488k rows the whole loop takes 61s! that's over 1.25ms per cycle! What is taking all that time? while($row = $res->fetch_assoc()) { $clist[$row['upload_id']][$row['dialcode_id']][$row['carrier_id']]['std'] = $row['cost_std']; $clist[$row['upload_id']][$row['dialcode_id']][$row['carrier_id']]['ecn'] = $row['cost_ecn']; $clist[$row['upload_id']][$row['dialcode_id']][$row['carrier_id']]['wnd'] = $row['cost_wnd']; $dialcode_destination[$row['upload_id']][$row['carrier_id']][$row['dialcode_id']]['other_destination'] = $row['destination_id']; $dialcode_destination[$row['upload_id']][$row['carrier_id']][$row['dialcode_id']]['carrier_destination'] = $row['carrier_destination_id']; } Now resultset of 10 rows, smaller arrays and performance 30 times higher (0.041ms) not the fastest still but better. while($row = $res->fetch_assoc()) { $customer[$row['id']]['name'] = $row['name']; $customer[$row['id']]['code'] = $row['customer']; }

    Read the article

1