Nmap Development mailing list archives

Re: [RFC] Some NSE optimizations


From: Patrick Donnelly <batrick () batbytes com>
Date: Wed, 11 Jul 2012 16:39:44 -0400

On Tue, Jul 10, 2012 at 6:36 PM, Daniel Miller <bonsaiviking () gmail com> wrote:
1. nse_main.lua: tcopy(). This function gets called recursively on the host
and port tables for each hostrule, portrule, and associated action
functions. In my simple scan of one host, I saw 1402 calls with a total time
of 1.9 seconds. I implemented it in C++ using lua_rawset, and saw a roughly
10x speedup (494 Lua function calls, the recursion is done in C++).

I'm generally wary of moving what is a fine Lua function to C.
However, if the speedups are worth it then go ahead. I'd like to see
what the speedup is for *NSE startup* in a larger scan (lots of ports,
lots of scripts, lots of hosts). I've attached a slightly improved
tcopy in C that has some missing checks and is a little shorter.

-- 
- Patrick Donnelly

Attachment: tcopy.c
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: