[baloo] add (and use) FileIndexerConfig::shouldFileBeIndexed(const QStringRef&)

Review Request #129349 - Created Nov. 6, 2016 and updated

Information
Christian Ehrlicher
baloo
Reviewers
baloo

Use the new QStringRef class to avoid creation of temporary QString objects.
Since every filename is sent through FileIndexerConfig::shouldFileBeIndexed(), I think this is a good optimization although now there are two functions for FileIndexerConfig::shouldFileBeIndexed() and RegExpCache::exactMatch() - one with QString and one with QStringRef ...


  

Issues

  • 0
  • 4
  • 0
  • 4
Description From Last Updated
Christian Ehrlicher
Aleix Pol Gonzalez
Kai Uwe Broulik
Aleix Pol Gonzalez
Christian Ehrlicher
Christian Ehrlicher
Kai Uwe Broulik
Christian Ehrlicher
Review request changed

Change Summary:

Avoid one more string allocation in FileIndexerConfig::shouldFolderBeIndexed() by using midRef() early, rebase to current HEAD

Diff:

Revision 4 (+50 -25)

Show changes

Kai Uwe Broulik

   
src/file/fileindexerconfig.cpp (Diff revisions 3 - 4)
 
 

You sure this doesn't crash? I've seen crashes when you directly chain a Ref to another method.

  1. Where do you see a chained ref?

  2. I don't see a problem here. QString::midRef() returns a reference to path. QStringRef::mid() works on this reference and once again returns refernces to path. Since path is still alive then, all is fine. If this should somehow crash it's a but in Qt...

src/kioslaves/tags/kio_tags.cpp (Diff revision 3)
 
 

Can this even happen? You check for path being empty, if it's not empty split() returns a list always containing at least one item.

Also, why remove const?

  1. Nevermind, you remove empty parts.

Loading...