Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

samtregar (2699)

  (email not shown publicly)

Journal of samtregar (2699)

Wednesday November 27, 2002
12:31 AM

The Cold and The Code

[ #9166 ]
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.


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.