Nmap Development mailing list archives
[NSE] Unused library cleanup
From: Daniel Miller <bonsaiviking () gmail com>
Date: Sun, 8 Jul 2012 08:27:25 -0500
List, I wrote a small Perl script (attached) that checks for Lua libraries required but not used (for one definition of used). I'm also attaching the patch that I came up with based on its output. A few notes: 1. Some libraries have effects simply by "require"-ing them (strict, package). I didn't do anything with these. 2. I'm not sure if the "method"-style of function use is affected by having or not having a local reference to a library. For example, string.format("%d", 3) runs faster if local string = require "string". But is the same true for ("%d"):format(3)? The lua opcode for the first is "GETTABLE" when string is local, and for the second is "SELF", no matter if string is local or global. I tried to find uses like these and leave the requires in place if I found them. 3. packetdecoders.lua had requires inside functions, which I think is not a great idea, since those functions should try to be as fast as possible. I moved them to the top of the file instead. Please let me know if I should commit this, or if I'm way off base! Dan
Attachment:
libs.pl
Description:
Attachment:
unused-libs.patch
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [NSE] Unused library cleanup Daniel Miller (Jul 08)
- Re: [NSE] Unused library cleanup David Fifield (Jul 09)
- Re: [NSE] Unused library cleanup Patrick Donnelly (Jul 09)
- Re: [NSE] Unused library cleanup Daniel Miller (Jul 09)