Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is large `if' or `case' statement a potential cause of a slow-down?



On 13 June 2018 at 17:20, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> In my case it's because I don't presently have time to do more than
> toss off a quick one-line reply, and (aside from not being exactly
> sure what "big-loop" means), this needs a lot more depth.

Basing on FSH, such big-loop doesn't call functions. What emerges is
thus a long, non-structular code (IIRC, lack of meaningful functions
<=> no structural programming). It's like having one function that
does everything. Here one big-loop does everything. And it contains
other "does-everything" constructs, like big-ifs and big-cases. One
`case' in FSH code has 6 screens (30 lines each). Whole loop has 18
screens. That's why this is great, to decompose this big-loop, and
even gain (that much) performance. This also suggests that the answer
to the initial question is: yes, big if, case, etc. can harm
performance.

-- 
Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author