P is for Practical | |
PerlMonks |
Re^2: Are there any drawbacks to comments -- can they hurt the performance of Perl code?by liz (Monsignor) |
on Aug 14, 2006 at 21:45 UTC ( [id://567347]=note: print w/replies, xml ) | Need Help?? |
Unfortunately, I think there is at least *one* corner case where having comments actually do make a difference: extended regular expressions with interpolated variables with or without comments.
Mind you, you're going to have to do a lot of regular expressions before you actually start noticing this.
The reason for this is most likely because of the variable interpolation (so Perl cannot store a compiled version of the regular expression) and the fact that extended comments are actually part of the string when the regular expression is being compiled. Of course, most regular expressions that warrant the extended format with comments, are also the more complicated ones, so in the real world, this might still be a bit worse. (I leave this as an excercise for the reader). On the other hand, saving one hour of your coworkers time when (s)he has to look at your code, is usually worth much more, so your mileage may vary ;-) Liz
In Section
Seekers of Perl Wisdom
|
|