Menu

#325 new rule: constant pattern inside a loop

open
nobody
None
5
2013-02-16
2011-07-18
No

Creating a constant regex pattern inside a loop is a performance hit (from Jochen T).

So Don't do this:

5.times {
def pattern = ~/(a-z)[0-9].*/
'asdf' ==~ pattern
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.