4 ms·
Hopefully it will look mostly like random noise, without many patterns. That would indicate compressed information without much repetition. If you see lots of r
by shurcooL 14y ago
Hopefully it will look mostly like random noise, without many patterns. That would indicate compressed information without much repetition. If you see lots of regular patterns, perhaps that means refactoring is in order to maintain DRYness.
Hmm, curious if this visualization would actually work to spot duplicated code.
- algorias 14y agoHopefully it won't actually. Most languages are not designed for compactness of source code, and most forms of factoring will produce fairly noticeable patterns; e.g. lots of funcion declarations.
- shurcooL 14y agoTrue. One would have to first reduce the natural duplication/patterns that come with the language (i.e. function declarations, etc.) so that only the meaningful user code is left, before such analysis would be useful.
- btbuildem 14y agoBack in the days of A500, you could point the video viewport at any part of the memory -- including currently executing code. Watching lz decompress files was mesmerizing.
- jes5199 14y agoYeah, you're describing Shannon entropy: http://en.wikipedia.org/wiki/Entropy_(information_theory) http://en.wikipedia.org/wiki/Entropy_(information_theory) so that means DRY is "try to maximise entropy" gzipped files should also look like random noise, for the same reasons.