cmfans Posted February 8, 2010 Share Posted February 8, 2010 I'm currently writing gallery software for the fun of it and I have a question about performance. Would it be faster to save a list of images in a database and read from the database, or dynamically read through each folder in the gallery server for every image that currently exists. Right now my gallery reads through each folder for each currently existing image on page load. If I changed it to a database-based model I'd have to write some more code when images are uploaded but that wouldn't be too bad if it would be much faster. Also, would using a database cut down on server cpu usage? Any insight is appreciated. Here is an example gallery based on my code: http://www.blowthecart.com/christinemendoza Link to comment https://forums.phpfreaks.com/topic/191396-which-is-faster-reading-through-folders-or-database/ Share on other sites More sharing options...
RussellReal Posted February 8, 2010 Share Posted February 8, 2010 shes pretty hot, I'd hit it.. but with a database you'd be better off. You'd be able to fit way more information around the images with a database, and the database won't be looking through folders just fetching data, also paginating will be a tiny bit easier.. so faster + better information capacity.. What you'd want to do is keep the images whereever they are, and in the database point to those images. Link to comment https://forums.phpfreaks.com/topic/191396-which-is-faster-reading-through-folders-or-database/#findComment-1009008 Share on other sites More sharing options...
cmfans Posted February 9, 2010 Author Share Posted February 9, 2010 Thanks. I guess I'll go ahead and use some databases. Link to comment https://forums.phpfreaks.com/topic/191396-which-is-faster-reading-through-folders-or-database/#findComment-1009183 Share on other sites More sharing options...
thewooleymammoth Posted February 9, 2010 Share Posted February 9, 2010 russell hit the hammer on the head. Databases will work much faster than any code most of us could write. and for those who could write stuff that works faster than databases. its not worth their time. they are writing the code for space rockets and whatnot. If your really worried about performance though, check into caching. Link to comment https://forums.phpfreaks.com/topic/191396-which-is-faster-reading-through-folders-or-database/#findComment-1009199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.