help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check for redundancy


From: tomas
Subject: Re: Check for redundancy
Date: Thu, 25 Jun 2015 09:47:41 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jun 24, 2015 at 11:23:41PM -0400, Stefan Monnier wrote:
> > To throw an unorthodox idea into the air, one could measure the compression
> > ratio (e.g. with gzip) and relate it to the compression ratio of "known
> > good" code (I know, I know... :-)
> 
> Compressing a file does give you some information about the amount of
> redundancy in that code, but that might not be the redundancy you care
> about (e.g. using longer identifiers will give you higher compression
> ratios, but that's usually not what's considered "redundancy in code").
> Also, it's not immediately clear how to go from this to finding the
> actual redundancy.

Yeah -- the thing was a bit tongue-in-cheek. Much of the redundancy is
(as you noted) in the eye of the beholder, and this is what makes this
discussion "interesting". You'd have to keep (as you say) the variable
names out of the equation (or do you? *I* for one consider "hungarian
notation" highly redundant -- let the type system cope with that,
others may not).

That said, I have seen this rough measure (gzip compression ratio) used
as a rough "similarity measure": compress each file separately, slap
both together and compress, and watch the reduction.

For a first step in exploratory work, just to learn what one really
wants to put into the term "redundancy you care about" it might
be useful.

regards
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlWLsh0ACgkQBcgs9XrR2kZDVwCfRyAPGKBVFtkWrm1BapWAPqcd
q4AAnRe8hLtPYhLzesXveBuvcJcDlolj
=YpFU
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]