[PATCH] Performance problems on opensuse version of smart

Maciej Kowalczyk mikazkow at tlen.pl
Mon Aug 27 20:54:55 PDT 2007


Hi,
I really like Smart package manager but unfortunately the version from  
suse repositories sometimes works much slower than one from SVN trunk.
With help from python profiler I concluded that the weakest link is  
sorting long lists of packages (I have over 12k them in my db).
The source of problems in your version is  
smart-better-x86_64-support.patch file. It heavily modifies complexity of  
RPMPackage.__lt__ method which is critical during sorting operation.
I created a new version of this patch where some things are precomputed  
and saved in fields of RPMPackage object. This precomputation takes places  
during cache loading.
Then it became clear that another bottleneck is function archscore which  
is called at least once for every package. It's value depends only on  
package's arch so I added a memoization of its results. Therefore I assume  
that architecture's score won't change during program runtime. It's a  
relation between the architecture and one of the running system so it  
shouldn't. This technique can of course also be used stock version of  
Smart.
I'm attaching this modification as a new version of another of suse  
patches: smart-fix-archscore-add-disable-biarch-option.patch. If you  
prefer patches' patches instead, I include them also.

After applying these two patches instead of the two from version 0.51-34.1  
'smart query' test runs twice faster in my config. Also GUI looks more  
responsive.

Any comments are welcome. I hope it gets commited somehow.

--

Maciej Kowalczyk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart-better-x86_64-support.patch
Type: application/octet-stream
Size: 2540 bytes
Desc: not available
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20070828/feef2277/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart-fix-archscore-add-disable-biarch-option.patch
Type: application/octet-stream
Size: 3745 bytes
Desc: not available
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20070828/feef2277/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart-fix-archscore-add-disable-biarch-option.patch.patch
Type: application/octet-stream
Size: 1927 bytes
Desc: not available
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20070828/feef2277/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart-better-x86_64-support.patch.patch
Type: application/octet-stream
Size: 3401 bytes
Desc: not available
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20070828/feef2277/attachment-0011.obj>


More information about the Smart mailing list