|
|
Subscribe / Log in / New account

Are all patches created equal?

Are all patches created equal?

Posted Jul 21, 2011 13:14 UTC (Thu) by canatella (subscriber, #6745)
Parent article: Are all patches created equal?

Measure the entropy added by the patch to the kernel code ;)


to post comments

Are all patches created equal?

Posted Jul 21, 2011 13:39 UTC (Thu) by ortalo (guest, #4654) [Link]

I second this very nice idea too!

Are all patches created equal?

Posted Jul 21, 2011 22:07 UTC (Thu) by jspaleta (subscriber, #50639) [Link]

that's actually a very very clever idea. It would reward both people who do code clean ups by removal of duplicate code snippets as well people who inject non copy-pasted code snippets, including usable documentation and comemnts.

Like everything else its subject to being gamed. Obviously random bits of obfuscated code in a commit would show up with high entropy and thus high value. However such a piece of code would probably be selected against in human review/sign off as it would be highly unreadable. So I think the entropy metric strikes a good balance there.

I think as this idea is probably make a great comparison metric with just the raw commits as a positive impact assessment that is understandable to the main audience without getting too bogged down into very detailed scoring algorithms. From an information theory pov, commits which caused the overall codebase to go up in entropy is a higher positive impact than those which lower entropy. We can actually start asking the question who is just pumping out trivial commits that are overall low impact, and find a way to encourage them to take the leap to something high impact.

The side effect of that of course is that, over time, if people strive to reach the top of the entropy impact metric, we could see the kernel codebase become less and less compressible. Hopefully this is offset by large amounts of cleanup that shrinks the overall size of the codebase to offset the entropy increase leading to less compression.

-jef

Are all patches created equal?

Posted Jul 22, 2011 11:28 UTC (Fri) by droundy (subscriber, #4559) [Link] (1 responses)

But wouldn't certain valuable changes consistently decrease the entropy of the kernel? I'm thinking of things like an ARM rewrite that removes board-specific code...

Are all patches created equal?

Posted Jul 22, 2011 16:25 UTC (Fri) by rgmoore (✭ supporter ✭, #75) [Link]

I think it depends a lot on exactly how you measure entropy. You can either look at the total entropy of the code or you can look at some kind of entropy density like entropy per line or character of code. Adding code by copy/paste/edit will increase total entropy but decrease entropy per size. Refactoring the mass of duplicate code into something more compact may reduce the total entropy a little, but the drop in size should be enough for it to cause an increase in entropy per size. You'll probably want to look at both measures, just as the current system looks at both lines and changesets.

The problem with entropy based measurements is that they're really only useful for looking at the quantity of function; they don't say anything about quality. A one line patch that fixes a nasty bug in critical code has very little effect on entropy but a huge effect on correct function. And removing dead or deprecated code can be very valuable from a maintainability standpoint precisely because it reduces the total entropy.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds