So I just updated them with my modifications. Smart-fix-archscore-add-disable-biarch-option.patch, which modifedĪrchscore function. Quick look through opensuse specific patches was enough to find What saddened me was that this version wasĮven slightly faster than one modifed by me.
#Smartsvn clear cache Patch
I downloaded SRC.RPM and realized that my patch doesn't apply atĪll to a stock smart 0.51. Modified version: 0m3.91s Preparing patchesĪt that moment I was so happy with my modification that I wanted Rc = -cmp(self.archscore, other.archscore)Ĭomparison of mean run times of both versions, as I anticipated, was Normal computation of function, but saving result in archscores IĪlso added memoizing results of archscore function. The latter because at this stage I didn't want toīreak compatibility of cache across different versions of Smart. Must have be done in construction but also in deserialization method Save the resuts in fields of RPMPackage class. So my first optimization was to precompute as much as possible and Moreover the result depends only on package's arch not on It is called more thanĪccording to RPM documentation package archscore is a relationīetween system architecture and package architecture so it can'tĬhange during program runtime. Visible that archscore function is guilty. Three time slowdown? Psyco does its job well.
![smartsvn clear cache smartsvn clear cache](https://img-blog.csdnimg.cn/20190418142044114.png)
The ticks in these results are miliseconds. Result of running 'smart query' with profiler but Run it without JIT-compilation: '-o psyco=0' Rc = -cmp(archscore(selfarch), archscore(otherarch))Īs we see there is no call to function _getattr_ as in screenshotĪbove. If rc = 0 and self.version != other.version: Otherver, otherarch = splitarch(other.version) Selfver, selfarch = splitarch(self.version) This is its definition: class RPMPackage(Package): Result of running 'smart query' with profiler My first test was running simple query without GUI but with Good test case is calling 'smart query' command which just lists all Very similar behaviour could be observed in command line UI. From user's point of view,įirst it loads a cache, updates it if necessary, and after a strangeįew-second delay shows a package list. Moreover someĬritical parts (like mentioned cache) of program are rewritten in C
#Smartsvn clear cache code
To machine code at startup with some optimizations. Querying RPM database at every program start.Īnother interesting technique is using Psyco. This spares parsing channel information and It includes information about channels, packages and One of them is a cache which contains most of program objects in Smart internalsĪs I said before Smart it was written in Python.
#Smartsvn clear cache full
This language you should somehow force full pre-compilation or run it The exact command I used was: PYTHONPATH=/home/maciek/OOS/smart/working:$PYTHONPATH lsprofcalltree.py -o /tmp/calltree `which smart` kcachegrind /tmp/calltreeĪnother useful tool was bash built-in time command called like this: time (PYTHONPATH=/home/maciek/OOS/smart/working:$PYTHONPATH `which smart` )Īnother thing worth noting is that Python does precompilation toīyte-code after each change in code. It was very helpful in visualising bottlenecks. Script to cachegrind/calltree format and opened it with Was then converted using lsprofcalltree.py home/maciek/OOS/smart/working is a directory containing a 'smart'Īs a profiler I used Python standard cProfile module. Overrides some files that Python seeks in it's installation folder. This is very similar to LD_PRELOAD or Java CLASSPATH trick. To achieve this I used this command: PYTHONPATH=/home/maciek/OOS/smart/working:$PYTHONPATH `which smart` My working copy instead of those from /usr/bin/python/site-packages. Had to tell python (because it's written in Python) to use files from
![smartsvn clear cache smartsvn clear cache](https://image.slidesharecdn.com/99f52873-471c-431e-85a4-fa2d0ff96b63-160518052728/95/svn-48-638.jpg)
I already had some version of Smart installed on my system so I Smart repository and (in later part of the article) smart SVN repository. Packages in 19 channels, including system RPM database (about 1000)įor this work used smart-0.51-34.1 from suse My config was a 2 GHz CPU, 2 GB RAM laptop. Unfortunately in my config it took over ten seconds for Usually, just after starting graphical interface of Smart I open Manager but has some performace bottlenecks in its GUI. In this article I wanted to describe my work in optimizing Smart
![smartsvn clear cache smartsvn clear cache](https://i.stack.imgur.com/iULnn.png)
Kowalczyk, Optimization of the Smart package manager Optimization of the Smart package manager starting time Maciej