gencodephp Posted May 18, 2008 Share Posted May 18, 2008 Hi everyone, I am new here, so please go easy on me Currently I am drawing a table, with roughly ~250,000 cells. Each cell is unique, and is clickable (each cell contains a unique onclick function). Upon each click I am calling ajax to query multiple databases. My problem lies in the drawing of this 250,000 cell table. The rendering of this table can take ~2 minutes on a fairly fast computer. Is there anything I can do to speed up the rendering? Drawing a 25,000 cell table is no problem (10 secs rendering). But I would like to draw this large table in that same time. This is a live web application and would like it to stay that way. (no standalone code). I would be willing to switch to java/c++/perl cgi if the performance gain was great enough. Any ideas? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/ Share on other sites More sharing options...
gencodephp Posted May 19, 2008 Author Share Posted May 19, 2008 Here is some simplified sample code for what I am trying to do... save as test.php <table bgcolor='black'> <?php for($tr=0;$tr<1500;$tr++) { echo "<tr height=5>"; for($td=0;$td<100;$td++) { echo "<td bgcolor='blue' width=5></td>"; } echo "</tr>"; } ?> </table> I have read that specifying a fixed size should help things. As well as specifying a COLGROUP tag? But nothing I have tried helps just yet... Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-544533 Share on other sites More sharing options...
TheFilmGod Posted May 19, 2008 Share Posted May 19, 2008 There is absolutely no reason for you to bringing up over 250,000 cells. Let alone, more than 1,000 cells. Your application is poorly designed. You should try to cut it down. :-\ Maybe having a search feature, or viewing every 500 records? Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-544547 Share on other sites More sharing options...
gencodephp Posted May 19, 2008 Author Share Posted May 19, 2008 This is a data visualization application. It is a heatmap tool. Each cell is colored according to its associated value. There is no printed text in each cell. The point of this application is to spot trends, or data clusters using the human eye. I realize I can use a search feature or only display X number of points. However it would be ideal to view all at once... I also realize that I could build the image on the backend and then use imagmaps to allow each cell to be clickable. I am just looking for any hints on how to optimize/enhance the table rendering. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-544615 Share on other sites More sharing options...
TheFilmGod Posted May 19, 2008 Share Posted May 19, 2008 I also realize that I could build the image on the backend and then use imagmaps to allow each cell to be clickable. You just answered your own problem. "Problem solved"?? ??? Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-545274 Share on other sites More sharing options...
rhodesa Posted May 19, 2008 Share Posted May 19, 2008 Yeah, I would draw the image (using GD). Depending on how long that takes, you may need to cache it, and only update it every 5 minutes or so. Then, use an onclick on the entire image, and send the coordinates as to where you clicked on the image over the AJAX. That way it's just one onclick. Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-545279 Share on other sites More sharing options...
gencodephp Posted May 20, 2008 Author Share Posted May 20, 2008 I appreciate all of the help. I was worried that I would run into the same problems drawing a 250,000 cell imagemap. But organizing the coordinates in a way to control the onlicks is a great idea. Thanks everyone - I will give it a shot. Quote Link to comment https://forums.phpfreaks.com/topic/106236-drawing-large-table-250000-cells/#findComment-545798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.