XP is just a number | |
PerlMonks |
Time reading file sizeby htmanning (Friar) |
on Jan 16, 2018 at 01:10 UTC ( [id://1207329]=perlquestion: print w/replies, xml ) | Need Help?? |
htmanning has asked for the wisdom of the Perl Monks concerning the following question:
Monks,
I have a site that I have a Settings database for. My scripts check the database for certain preferences for the site. However, adding an additional database call seems to slightly slow down my search script, so my workaround is to write text to a .txt file whenever I change a certain preference. If the preference is set to YES I put the word "yes" in the .txt file. If it's set to NO, I zero out the .txt file. Then, in the search script, I check the file size of the .txt file. If it is zero I do one thing, if it is anything more than zero I do another. My question is, doesn't this also add additional time to the search script? It seems like I can tell the difference in using the flat file but I wanted some feedback on it. Do you think it is faster to read the file size or make the database call? I do have a .sub file that gets read by the search script on every load. I could hard code this preference there, but I want to be able to set the preference in a browser. Therefore, I'm using the .txt workaround. Thanks!
Back to
Seekers of Perl Wisdom
|
|