From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32082 invoked by alias); 28 Jun 2011 18:54:33 -0000 Received: (qmail 32072 invoked by uid 22791); 28 Jun 2011 18:54:32 -0000 X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL,URI_BLOGSPOT X-Spam-Check-By: sourceware.org Received: from mail-vw0-f43.google.com (HELO mail-vw0-f43.google.com) (209.85.212.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Jun 2011 18:54:18 +0000 Received: by vws10 with SMTP id 10so492271vws.2 for ; Tue, 28 Jun 2011 11:54:18 -0700 (PDT) Received: by 10.52.65.129 with SMTP id x1mr10719209vds.99.1309287257761; Tue, 28 Jun 2011 11:54:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.158.103 with HTTP; Tue, 28 Jun 2011 11:53:57 -0700 (PDT) From: Sravan Bhamidipati Date: Tue, 28 Jun 2011 18:54:00 -0000 Message-ID: Subject: Programming Anti-patterns in Shell and Perl Scripts To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-06/txt/msg00320.txt.bz2 Hello Cygwin. :-) I have been working on static code analysis from a performance perspective, and I recently applied the concept to Shell and Perl scripts. The most basic idea was to look for usages of Unix commands, their combinations with pipes, and stuff like that to which alternatives using Shell built-ins (or Perl functions) could be possible. e.g. Using ((num++)) instead of `expr $num + 1`. In examples where I had "fixed" anti-patterns, there was often a noticeable improvement (mostly realized in the form of faster runtime). I have also written a dirty parser and put together basic "guides" to go about this: http://bsravanin.blogspot.com/search/label/anti-patterns. Among Cygwin packages, bash-completion has some of the highest programming anti-patterns, but there are various others as well. Does this seem like a useful idea? If it is, what could be a good way of going about implementing it? Thanks, Sravan -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple