From: Austin S. <te...@of...> - 2002-05-15 02:22:08
|
On Tue, May 14, 2002 at 06:04:28PM -0700, Syamala Tadigadapa wrote: > I have an in house perl application that uses Expect to tail to a legacy > program. > I have it run satisfactorily on multiple platforms. > > On linux platforms, I have sean a strange problem. The perl executable > monopolizing > a cpu after a while of execution time. The legacy program is too > loquacious and writes > a lot of stuff on the STDOUT. Perhaps thousands of lines are being > shown on STDOUT. > > The program is running correctly, but unbearably slow! Slow over 10 > times or worse. > Expect by default will match the entire output for a match everytime more output is created by the spawned program. If you have a verbose program that doesn't match it becomes difficult for perl to keep up. Typically the answer is to set max_accum() to some sane value, perhaps 10000. What can go wrong is if you set the max value to less than what is read you may lose matching data. Currently expect will read up to 8096 bytes at a time from a stream. Hmm, maybe it would make sense to make this some fraction of exp_Max_Accum. Alternately maybe it would make sense to trim exp_Accum _after_ the pattern matches rather than before. Austin |