ober Posted May 1, 2006 Share Posted May 1, 2006 So I have a project where I'm graphing 2 recordsets against each other, and each recordset contains 12000 records. I first pull the data out of a database and dump it into arrays, then I feed those arrays to the graphing function. The users have the option to graph up to 5 channels (columns of data) at a time, so before I was checking to see if the channel was selected and then adding a value to that specific array.What I've done (and I've run the timing numbers and it is faster) is to calculate the total number of channels that have been selected and us a switch without breaks to figure out how many I have to fill:[code] if($result && mssql_num_rows($result) > 0) { $d0 = array(); $d1 = array(); $d2 = array(); $d3 = array(); $d4 = array(); while($row = mssql_fetch_array($result)) { switch($fldcnt) { case 5: $d4[] = $row[5]; case 4: $d3[] = $row[4]; case 3: $d2[] = $row[3]; case 2: $d1[] = $row[2]; case 1: $d0[] = $row[1]; break; } } } else { $t1ok = false; echo '<br/><br/><p class="warn">There is no 10Hz data for test 1.</p>'; }[/code]I guess I'm just curious if someone would have a better way to do this, as I think I've come up with the best solution. Link to comment https://forums.phpfreaks.com/topic/8807-timingefficiency/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.