![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
Comparing memory requirements for hashes and arraysby pmas (Hermit) |
on Sep 03, 2001 at 21:11 UTC ( #109898=perlquestion: print w/replies, xml ) | Need Help?? |
pmas has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to decide how to implement my CGI script (reading from database into buffer-like structures). I am not ready to implement it in OO, DBIx::Recordset looks too complicated, Tie:DB claims is rather slow... I decided to go KISS way: just to implement simple layer around DBI calls to be used for 80% calls, and do rest by some custom way later, if and when needed. Now, thinking about reading one record of data: I can fetch array, or hashref. Reading into hash structure looks more promising (field values will be placed in hash elements, conveniently named as fieldnames), obviously it is for the price. But what is the price? I do not know how to find it. I am aware that premature optimization is evil, but before developing rules and guidelines I would like to know consequences of my decision. I can benchmark access time and compare hash and array, but how about memory usage? Right now it is not a big issue, but later my scripts should run website with dozens of daily users, using mod_perl. Before reading source, I would like to tap vast knowledge of our monks here and ask:
pmas
Back to
Seekers of Perl Wisdom
|
|