8:36 PM, Apr 28, 2007
Inadvertently Fixed
Um... weird.
I just did a minor code update to the backend of the site. The flat files that store the witty, well-timed captions to all my
pictures were previously in a colon-delimited format. That means that on each line in each file, the text would read, "PICTURE:CAPTION." One unfortunate thing about that setup was that any captions that had colons in them would be all screwed up. For example, if the caption I originally entered was "Caution: I have a massive motorcycle." it would read, "Caution" on the page when the picture is loaded. It was a frustrating limit that I had been meaning to getting around to fixing, but got around in the meantime by just avoiding using colons in the captions.
I'm about 36 hours into my first week of being on-call at the "new" job, and as such, I need to stay within arm's length of my computer. I was bored this evening, so I decided to convert my content files to a null character-delimited configuration, and after finishing with the work, it would appear now that what I did inadvertently served to fix my biggest complaint about bahua dot com. The pictures load quickly now! I'm not exactly sure what happened, but switching to a null character configuration appears to have eliminated all the slowness.
If it's still the same for you, let me know.
Brian said:
You could have also done:
($picture, $comment) = split ':', $_, 2;
That way everything after the first colon ends up in $comment..
3:00 PM, Apr 29, 2007
Brian commented:
Flat files are fine and good for a low-volume site like this, but not if you're getting thousands, hundreds or even tens of hits per minute. You can make up for it by storing the flat file in memory instead of reading it again every time, but then you're basically getting into what a database does for you anyway. Flat files are more fun to play with, though, I think. :)
7:50 AM, May 7, 2007