Quote:
|
Originally Posted by goldfndr
There are a lot of statements like:
$out_net_tag = $out_net->getElementsByTagName(tag)->[0]->getFirstChild->getData;
Shouldn't you just keep them all in memory rather than parsing and reparsing the XML? Something more like:
$out_net_tag = $tag{$bssid};
It should be quick enough that you might not even need the $out_net_tag variable, just use $tag{$bssid} directly.
|
If the script were to just "cat'ing" the files together, you are right, but since it's merging files and updating data for previously detected networks, it need to read the data continously. And it is working in memory vs rereading from the xml files:
I.E. First file read in, hash built. Next file, read one network, check if it exist in the hash, if so, get the data allready existing, update that data with the new data, then read next network, otherwise if not existing in the hash, add the data as a new record, and update the hash, then read next network, rinse repeat and spindry for all networks in second file, then repeat for next file.
I posted a pseudo-code overview of the way the script works in the original thread referred to in the opening post, which probably shows more clearly why the script does it this way.
Feel free to optimize more if you want to. Thats the reason it's been posted.
Dutch