in reply to Re^2: Removing Flanking "N"s in a DNA String
in thread Removing Flanking "N"s in a DNA String

With reference to your regex, I always find it a bit sadomasochistic to use regular expression meta characters to delimit a regular expression, it does kind of muddy the waters.

I prefer to use balanced delimiters for several reasons, not least of which is consistancy.

See 506374, though I have say the whole argument for using two statements rather than one seems like the most obvious case of premature optimisation--and yet it seems enshrined in the FAQ.

If your benchmark is correct, then you're talking of saving 13.18 microseconds per trim, which means you'll save a whole second every 75,872 trims you perform.

I also think that your benchmark is flawed, but I'll wait until mine has been picked apart before I argue that case :)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^3: Removing Flanking "N"s in a DNA String

Replies are listed 'Best First'.
Re^4: Removing Flanking "N"s in a DNA String
by reasonablekeith (Deacon) on Nov 07, 2005 at 16:11 UTC
    I prefer to use balanced delimiters for several reasons, not least of which is consistancy.
    I'm with you on that one, but you could use curly brackets. That way your regexes wouldn't look like big character classes.
    two statements rather than one seems like the most obvious case of premature optimisation
    The OP specifically asked for an efficient way of doing this. I saw your capture and thought it was unnecessary.
    I also think that your benchmark is flawed
    Well I didn't type out the results by hand :P

    Having said that, I've no idea how they would be affected by different data, but only the OP can do that properly, as we don't have a sample of the actual data to be proceessed.

    ---
    my name's not Keith, and I'm not reasonable.