Review Request 127236: Leverage QDir to know what's in a KIconThemeDir

Aleix Pol Gonzalez aleixpol at kde.org
Tue Mar 1 19:07:55 UTC 2016



> On March 1, 2016, 5:37 p.m., Aleix Pol Gonzalez wrote:
> > Eh... I just realized it's not 100% correct. We have a test (testUnknownIconNotCached) that fails, unsure how I didn't see it yesterday.
> > 
> > The problem with this one is that we are not reacting when icons are introduced at runtime. I tried adding a sneaky QFileSystemWatcher/KDirWatch on KIconTheme but it didn't signal.
> > 
> > Should I just discard the patch?
> 
> David Edmundson wrote:
>     Could you compare modified time of mBaseDirThemeDir and reload if needed?
>     it'd be one extra stat on the directory each time, but still a saving from before

That doesn't work, for some reason...
```
         // Install the existing icon by copying.
+        qDebug() << "xxxxxxxx1" << QFileInfo(actionIconsDir).lastModified();
         QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), newIconPath));
+        qDebug() << "xxxxxxxx2" << QFileInfo(actionIconsDir).lastModified();
```

Both return the same value.


- Aleix


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127236/#review93023
-----------------------------------------------------------


On March 1, 2016, 4:25 a.m., Aleix Pol Gonzalez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127236/
> -----------------------------------------------------------
> 
> (Updated March 1, 2016, 4:25 a.m.)
> 
> 
> Review request for KDE Frameworks and Christoph Feck.
> 
> 
> Repository: kiconthemes
> 
> 
> Description
> -------
> 
> At the moment we're playing Battleship to see if an icon is present in a subdirectory. This means that we are checking on every directory if there's an icon that matches the size with a said name on every request.
> 
> This can be seen easily with strace:
> ```
> $ strace kwrite |& grep ENOENT | wc -l
> 6212
> ```
> After the patch: 
> ```
> $ strace kwrite |& grep ENOENT | wc -l
> 1993
> ```
> We reduce these accesses to let QDir keep the list of files inside the directory (that was already being generated at some point, it just was being discarded).
> 
> 
> Diffs
> -----
> 
>   src/kicontheme.cpp 0996054 
> 
> Diff: https://git.reviewboard.kde.org/r/127236/diff/
> 
> 
> Testing
> -------
> 
> Builds, tests still pass, applications start noticeably faster.
> 
> 
> Thanks,
> 
> Aleix Pol Gonzalez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160301/4596b77d/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list