From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27573 invoked by alias); 13 Jun 2018 16:44:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43002 Received: (qmail 20443 invoked by uid 1010); 13 Jun 2018 16:44:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot0-f176.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.176):SA:0(-1.9/5.0):. Processed in 0.934428 secs); 13 Jun 2018 16:44:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uh2P9BroNFGawyf+Iu+goUewOaRvfkMbd4zdwb9ZAvY=; b=lHgqt0ce0oNnftM3OUEA439eZRFce4MuAZVqvR3M8Mexc9vRGqxlFA6M0I8G9/TrvK bDw6OMgopgi6iP4RbsCZUVDFnRP2cfo2h+uZ5Vs2bN164A1tKu7qDVCnbhwj7CGYRWy8 j6n0WNalqP59NK7wy5GCi+ClBHhgo/F27RGF2MzAIMtCwSAJriXUI8ISHJaD5qzGa6Ol csXAOxAuk7vQWTYZRX9/T0LRl5SELYcdr21mb7vgEEbtMPEXj87iMoSF03pVT4TMhjBG h05FRTMp1MfQx4gaIbO3KeVq7uQKkXoa6B/Iw+rpZl80SQI1Fg9ubgdqMlFPnf7SaHKS vfWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uh2P9BroNFGawyf+Iu+goUewOaRvfkMbd4zdwb9ZAvY=; b=cLYrFVX3N6QSo9jP9JfCBIJB01HlS3CCyx2cxtx/3GeNptfK/CAP6fQ1EsxtUpearB nN5erbvzAm2KoVEMGESYWRqOJz1pXyi2JFeBFOrcUaSpHTe2NWEMrQXta/lHTYlHPXj4 iKYr5iVs6bsdzqVyytf9jEPzNspczOZ10mFBRqvZbbd1jWwk9n5sH264yQ+fsfpe5ygR pgVvnK01WkAOW/ZZ8lcGslIyfk/8yt32UXvh8yNtu9t5PLah7mybBhVfXQQLcnoea3OZ P8/TKSfDTnyfl+WZEsgLrdP2XD81GgjA1CQW+NlfvdjnTjMlNBlt8V8GPBmk4HmFdXaF 2o9g== X-Gm-Message-State: APt69E2+e7DQ6sxv2Uf94CwLbR+s8bEQ/DGeaZQbtYZJhJApZuc3/xT7 Ei1ID3v4dIgRWNPU/7lcj9R1+jveT7RySLT5h/g= X-Google-Smtp-Source: ADUXVKLx2EFC4WC/ftWQWJzyRyAKUrx1/8bpPBeJkhKJ3v3SUJLCLmuhdS/qpn1f5a3Jdm9EGFIj56b/BLfolRZnmeI= X-Received: by 2002:a9d:5a8a:: with SMTP id w10-v6mr3733545oth.16.1528908254792; Wed, 13 Jun 2018 09:44:14 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Sebastian Gniazdowski Date: Wed, 13 Jun 2018 18:43:54 +0200 Message-ID: Subject: Re: Is large `if' or `case' statement a potential cause of a slow-down? To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On 13 June 2018 at 17:20, Bart Schaefer 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