Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Caching process setsby billyak (Friar) |
on Feb 19, 2003 at 19:45 UTC ( [id://236784]=perlquestion: print w/replies, xml ) | Need Help?? |
billyak has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a log parser. (My other question, Compiling Regular Expressions). Each log line has the standard timestamp followed by the event. I've found that if I seperate the timestamps from each line, approx 55% of the event portions of my sample log are repeats. The obvious solution would be to cache to results of the event parsing as to avoid repeatedly parsing the same thing. In the case of each event, I do some simple math to a variety of data types. Example: In the event of $event = "a access b via c (d) <e> <f>"; then
My question is, how would I cache such a set of simple operations and have them called should $event already have been parsed once? My only ideas include eval and from what I understand from reading and using it, eval is not the most speedy of options. Any insight would be appreciated. Thanks, -billyak
Back to
Seekers of Perl Wisdom
|
|