I have a powershell script that runs during an msbuild process and validates some stuff by extracting info from log files. The script loads 2 xml files and then does some validation from the data extracted from the log files. Usually the script takes on average 1 to 2 seconds to run. Loading the xml files takes around 800ms to run. Since the script runs 10000 times, it will load these xml files every single time and adding an overhead of loading time of 10000 * .8 sec = 8000 sec.
Is there a way to load these xml files once and then let the script use them for the 10000 times? Urgent help needed.