Repository navigation
Conversation
|
No big change if I put |
| } | ||
| } | ||
|
|
||
| static QString convertToRegexpSyntax(char *exclude) |
There was a problem hiding this comment.
QRegExp::escape(exclude).replace("_", "._").replace("?", ".")
|
Might be worthy to read: https://www.loggly.com/blog/five-invaluable-techniques-to-improve-regex-performance/ I think we can split the list into several groups:
And according to the blog post, the order of the expression could help too |
|
Note: This is not Qt4 compatible! |
|
@jvillafanez thanks, will check it out. FYI wrapping in Maybe I should test with a bigger dataset (testing 3400 files/folders now) to make the constant overhead part be less dominant. |
|
Oh well. I removed all the qDebug() I had added, now |
|
I have to say that I do not like this patch. Which problem are we really solving with this? The code does not really look straightforward, especially not with the hook thing. Which code would we replace by this? |
|
@dragotin I need to clean it up and have it tested, indeed. |
|
@guruz there are unit tests for the exclude files, please enhance them... |
|
I've done some work on this here, but it's not done https://github.com/ckamm/owncloud-client/tree/exclude_traversal_qregexp |
|
Note, I've also done performance tests on my version. It re-uses the performance test from check_csync_exclude that runs the default list of excludes against a non-matching path a couple of thousand of times. (it's a good test case, because it's close to what happens a lot in practice) In my tests I could optimize the regex version until it reached these values: So it's still almost 2x slower. :/ The regexes that get used are approximately: There's some cost from the utf8 conversions that need to be done on the path, but being incorrect and removing them doesn't bring the runtime down much. The bname and full regexes seem to account for about 50% of the time spent, each - and most of the time is the overhead of running QRegularExpression::match -- if all regexes are replaced with trivially non-matching ones, I get 0.001571 per call. EDIT: I had another optimization idea and reduced the number of regex match attempts from four to two (once on the basename, once on the full path) in the non-excluded case, speeding up to: But it's still 30% slower than the fnmatch version (which stays at 0.0013) |
So it improves! We're finding out right now why @ckamm has different behaviour (worse) on Linux. |
|
@guruz Here are new timings for Win7, Qt 5.3.2 in a VM: My hacked branch to make things compile on windows: https://github.com/ckamm/owncloud-client/tree/exclude_traversal_qregexp_win |
|
Collected timings
|
|
Note on the state of my branch at https://github.com/ckamm/owncloud-client/tree/exclude_traversal_qregexp: It does some very hacky things and has outstanding issues. It was only developed far enough for performance testing.
|
|
BTW Qt 5.9 mentions
|
|
I'm trying to work on this again.. |
|
@guruz I don't think we need to keep this open. I doubt we can salvage much of the experimental code in my branch. |
Unfortunately this does not speed up thins significantly yet, i only see csync_exclude_traversal going from 14.5% of time to 14.0% of time or so
But maybe I need to check if the JIT is really used and also add some of the other patterns that hardcodedly use fnmatch to the hook.
FYI @ckamm
It changes our exclude list to those two lists:
Maybe I can avoid having two regexp objects by using capture groups or something like that?