I woke up with my first cold of the season. Hair down the back of my throat, no nostrils, pounding headache, swollen eye sockets, etc. Dosed myself with Advil, Pseudoephedrine, Caffeine and Ginseng, to little effect. Eventually, things got better.
While waiting to feel better, I got to work on Config::ApacheFormat 1.1. A coworker of mine had suggested a couple good ideas for new features. Also, I realized while spell-checking an email that I spelled "inheritance" wrong, both in the docs and in the API. So, I've deprecated my wrong spelling on the off-chance that someone dove on the code and started using it the day after it came out. I'll remove support in the next version and hopefully forget the shame of it all by this time next year.
Once those important issues were out of the way, I got down to my favorite part, optimization. First I removed the recursion from the get() method, which was satisfying. Then I got a hold of the largest Apache conf I could find and ran it through the parser. After some time with Devel::DProf I had the parser running in half the time.
The huge config had some constructs I didn't realize were possible, and I fixed my parser to handle them.
And to top it all off, I removed the need to load the entire file before parsing AND added support for tracking the filename and line number inside included files for use in error messages. The two were related because I'd taken the easy way out by using a single @lines
array and just doing an unshift(@line, <$include_fh>)
when I came across an include directive. Simple to code, but abusive of both time and memory.
A pretty good day, all things considered.
-sam
-Dom
First I removed the recursion from the get() method
Did that actually make it faster. I expended some effort doing exactly that to XML::Filter::Sort and it ended up slower - I never worked out why.
-sam
-sam