Nmap Development mailing list archives
[Zenmap] Slow "Open" for large files
From: Jay Bosamiya <jaybosamiya () gmail com>
Date: Sun, 08 Jun 2014 18:28:36 +0530
Hi All! While I was testing things for my other patch (the MemoryError one), I came upon this rather strange thing. A scan that I had run took 30 seconds to run, about a second to save, but hours to load. The "Open" option was too slow for large files! Some analysis showed that the Open option was using string concatenation and this made the algorithm quadratic in time complexity. (Thanks Dan for pointing out that string concatenation is slow in Python). Modifying this to use StringIO immediately improves the speed. The same file opened in under half a minute!!! Attached is the patch for the same. I had to refactor some other parts of the code for zenmap/zenmapCore/NmapParser.py too (since _nmap_output is used in some places where nmap_output should be used). I have tested this patch and there seems to be no problem. Feedback is welcome. Cheers, Jay PS: The command I used to generate the large file is "nmap --packet-trace -r --top-ports 1000 127.0.0.1/24". The generated xml file (using "Save" from Zenmap) is about 20 MB in size!
Attachment:
speedUpOpen.patch
Description:
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [Zenmap] Slow "Open" for large files Jay Bosamiya (Jun 08)
- Re: [Zenmap] Slow "Open" for large files Daniel Miller (Jun 08)
- Re: [Zenmap] Slow "Open" for large files Jay Bosamiya (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Jacek Wielemborek (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Jay Bosamiya (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Daniel Miller (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Jay Bosamiya (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Jay Bosamiya (Jun 09)
- Re: [Zenmap] Slow "Open" for large files Daniel Miller (Jun 08)