in reply to Re: Support for hash comments on a line (Why use a regex at all?)
in thread Support for hash comments on a line

Unless you're dealing with a large number of lines here, the performance penalty of going with a regex is, in my opinion, inconsequential compared with the added readability of code that uses it. No one skimming the code above is going to have the slightest idea what it does without studying it.

Though don't get me wrong, if your requirements are such that you're going to be doing this sort of processing on a lot of data, and performance is a factor, this is one of many optimizations that can be made to squeeze speed out of the algorithm.

  • Comment on Re: Re: Support for hash comments on a line (Why use a regex at all?)