[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [TSVN] Autocompletion list in the commit dialog

From: Eric J. Smith <eric_at_ericjsmith.net>
Date: 2005-02-16 20:49:19 CET

Stefan,

Most of the regular expressions posted so far are going to be very slow on
large files. They are using positive look behinds which means that for
every single word boundary in the entire file, the regex engine will look
behind that word to see if your positive look behind matches. For instance,
take the .h regex:

(?<=class[\s])\b\w+\b

Rather than forcing the regex engine to consider every single \b (word
boundary), what would be way more efficient is to look for instances of
"class" and begin matching there. There should be a hell of a lot less
instances of class as opposed to \b (start of a word).

Also, the whole double pass regex doesn't make a lot of sense to me either.
Why not just use captured groups inside of a single regex? Something like
this would work just fine for your .h regex:

class\s+(\w+)

Notice the parens around \w+, that will cause the regex engine to capture
whatever the \w+ matches to a captured group. Then in your code you take
the matches returned by the regex and add all captured groups to the
auto-complete list. This totally skips the second regex pass, has the same
result, and keeps you from doing slow positive look behinds.

Eric J. Smith

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Feb 16 20:53:20 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.