If you modified this to output to a file and included the generated file as the master CSS file on all pages it would only need to perform it's parsing once after the source CSS files change. You could call the script manually after making changes to your CSS, or include a call from each page and add a function to this to check timestamp on the master CSS file against the timestamp of the source files.
Just a thought. Might do that myself.