Y
To address such problems, the best is characterize the process:1.- Identify Where's the bottleneck.
Is it leshosp or your script?, Is it the XML parseum or regular expression sanitization?.2.- Watch with operating system tools to identify which resource is exhausted
(e.g. physical memory, exchange or cache, disk space) and/or the one used more intensely (e.g. reading/writing to disk, network, processor, database);
They usually jump in sight.3.- Quantify. Normally you will find a direct relationship between the number of items to be processed (e.g. number files, records or lines) and the duration of the bottleneck(s).The first exercise would be to intercalate messages with time, minute and second before each main code block,
or even between each line; where there is the greatest difference to deepen as far as possible.Depending on the findings, the solution could be a simple command, a configuration change, resource increase,
and in the worst case implement any of the techniques for long-lasting processes like: asynchronous processes, message queues, subprocesses, multi-hylos, etc.