X-Recipient: archive-cygwin AT delorie DOT com 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 MIME-Version: 1.0 From: Sravan Bhamidipati Date: Wed, 29 Jun 2011 00:23:57 +0530 Message-ID: Subject: Programming Anti-patterns in Shell and Perl Scripts To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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