The Lab - threadlist.php database access details 2004-18-2 clank-o-tron [webmaster@microsponge.org] Original line numbers line 14 get access level of current user line 20 get number of replies to guest thread line 24 get timestamp of most recent reply to guest thread line 31 get id of threads with high priority line 58 update cranial analysis (single) line 63 update cranial analysis:math line 65 update cranial analysis:physical line 67 update cranial analysis:rants line 72 update cranial analysis:romance line 74 update cranial analysis:reminiscing line 76 update cranial analysis:art line 81 get poster,title,id,postnum,topic,stamp from post matching category regexp line 170 get fullname from first poster on thread line 177 get fullname from last poster on thread local overhead approx 0.38 sec remote overhead approx 16 seconds Optimized loops using lines 170 and 177 Previously, there was a db call in a loop. In order to determine the fullname of the last poster to a thread, the loop called the db and requested the last name of each thread. The code was rewritten to make an associative array of lastnames (keyed by names) which the loop then called. It is predicted this is where most of the overhead was going (it added a minimum of 40 database calls and a maximum of shown_thread_quantity*2). Pruned cranial analysis to one call (compared to 1-3 calls) Both the right and left brainsides (depending on which one was called) would execute one database call per brain classification (currently 3 on both sides). This was consolidated into one statement that simultaneously updated all brainside classifications. Consolidated two guest-thread related calls into one - approx 0.35 sec Originally, there were two db calls - one to get the number of posts on the guest thread, and one to determine the timestamp of the last reply. 6 database calls from removed from source. On average, 40 fewer database calls take place on a server. Locally, overhead reduction results are negligible. Vast improvement predicted on live server.