|    From: Akim Demaille <[EMAIL PROTECTED]>
|    Date: 26 Apr 2000 18:41:32 +0200
| 
|    If you concentrate the measure on this very script, the performance
|    penalty is frightening:
| 
| It certainly is.  This is a performance bug in mawk.
| I observed the bug in mawk 1.3.3.
| 
| To work around the problem somewhat, please try replacing this:
| 
|   while (sub(/__oline__/, oline))
|     continue
| 
| with this:
| 
|   if ($0 ~ /__oline__/)
|     while (sub(/__oline__/, oline))
|       continue

!!!

I don't understand this at all.  The performance loss is precisely
there, you don't even have to apply the same transformation to the
other patterns.


Hm, I see, what's really expensive is the fact that `oline' is
changing: if you remove `oline++' it flies again.  I suppose it means
it has to recompile something for each value of `oline', but I don't
understand why recompiling a regex or something is needed when the lhs
of a s/// is changed.

Thanks for the cure, I'll apply it right now.

        Akim

Reply via email to