Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Performance numbers on "if [" vs. "[" alone vs. "if [[" vs. "[[" alone
- X-seq: zsh-users 21931
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Performance numbers on "if [" vs. "[" alone vs. "if [[" vs. "[[" alone
- Date: Fri, 16 Sep 2016 09:23:44 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=qXxxr2kmglr7MWUp3FMxtEfbLWlLkXMxL1pvtxcUbGI=; b=CrAzjNuKUvwoGVmZTem9V6WkWTrFCVJULCXDVJk1cCPOCMkZaay9WzeA2D+V3QaPfF WpwUXrZbvnqX7FTIBvv1gJ3q2HwZ6W0FipvJwA04qiTOZDdZw9Q0HbGuf1k6krCe3o9H N3Y0uHKKqJeHBOPgAENvlftFDFYX6wRI59js1Z1Rld721I6InRHsZNwQ81CK8ZHx6e71 FNv/7chIEl5O2wkCgToqRAn6i8QKv6l976gRE4bZZbR+W7ULKGRyUUGwGTLz+/MCRRSl omGWV/aVUQUyEog2RMIuZ683llFsMvN0j6C6BmgIVtl7gkp3aVu3iKYZZgPOTgVCyfCM akMg==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
% zsh-5.2 -f
===> if [ "$a" = "1" ]
typeset -F SECONDS; SECONDS=0; repeat 100000; do if [ "$a" = "1" ];
then echo yes; fi; done; echo $SECONDS
1.0209490000
===> [ "$a" = "1" ]
typeset -F SECONDS; SECONDS=0; repeat 100000; do [ "$a" = "1" ] &&
echo yes; done; echo $SECONDS
0.6701160000
===> if [[ "$a" = "1" ]]
typeset -F SECONDS; SECONDS=0; repeat 100000; do if [[ "$a" = "1" ]];
then echo yes; fi; done; echo $SECONDS
0.5131310000
===> [[ "$a" = "1" ]]
typeset -F SECONDS; SECONDS=0; repeat 100000; do [[ "$a" = "1" ]] &&
echo yes; done; echo $SECONDS
0.0925930000
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author