Nmap Development mailing list archives

Re: [RFC] Some NSE optimizations


From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 11 Jul 2012 20:03:29 -0500

On Wed, Jul 11, 2012 at 3:39 PM, Patrick Donnelly <batrick () batbytes com> wrote:
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

Patrick,

I realized that the 10x speedup is likely hyper-inflated, since the
profiler imposes a timing penalty on Lua function calls, but not C.
I'll apply your new C-tcopy and see if I can more accurately determine
the impact.

Dan
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: