delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/06/28/15:21:26

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.2 required=5.0 tests=AWL,BAYES_50,SPF_NEUTRAL,URI_BLOGSPOT
X-Spam-Check-By: sourceware.org
Message-ID: <4E0A299D.5040504@cs.utoronto.ca>
Date: Tue, 28 Jun 2011 15:21:01 -0400
From: Ryan Johnson <ryan DOT johnson AT cs DOT utoronto DOT ca>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Programming Anti-patterns in Shell and Perl Scripts
References: <BANLkTinZih7DKLYxXxLBVpdmFn62Tu4kdA AT mail DOT gmail DOT com>
In-Reply-To: <BANLkTinZih7DKLYxXxLBVpdmFn62Tu4kdA@mail.gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 28/06/2011 2:53 PM, Sravan Bhamidipati wrote:
> 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?
I don't use bash-completion myself, but my understanding is that it can 
be very slow, if for no other reason than fork() is slow in cygwin. If 
your de-anti-pattern transformation causes fewer calls to fork() -- and 
the above expr example suggests it does -- it could be very worthwhile.

Implementation-wise, you probably want to start here: 
http://www.cygwin.com/contrib.html

Ryan


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019