in reply to Optimization for readability and speed (code)

<insert all of merlyn's comments here>. In addition to sticking to the RE, given the situation that you need to allow others to maintain this code, I would include in your comments the output of OGRE or some other such tool that english-fies the regex for non native regex speakers.

Also, I would try to make sure that you grab as much as you can from the regex even if your code now does not currently need it. Say that you have a 5 field line, separated by white space, and your app currently needs only 4 of the 5 fields. I would still declare and grab all 5 fields, with commenting describing what the field is given the input format. This way, if it needs to be modified down the road to use the 5th field, they simply need to start *after* the regex, instead of possibly messing up the regex and causing the other 4 fields to be inaccessible.

Dr. Michael K. Neylon - || "You've left the lens cap of your mind on again, Pinky" - The Brain
  • Comment on Re: Optimization for readability and speed (code)

Replies are listed 'Best First'.
Re (2): Optimization for readability and speed (discussion)
by deprecated (Priest) on May 01, 2001 at 00:15 UTC
    I've tried to get to OGRE before, and as far as I can tell it's broken. Any word on this?


    Laziness, Impatience, Hubris, and Generosity.