<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">Dnia Monday 05 January 2009, David Faure napisaĆ:<br>
> On Saturday 03 January 2009, Jakub Stachowski wrote:<br>
> > It is slow operation, because of mime-<br>
> ><br>
> > >is("application/x-desktop") check, which constructs KMimeType object for<br>
> ><br>
> > application/x-desktop type again and again.<br>
><br>
> Yep. I have on my todo list "optimizing KMimeType::is by adding a way in<br>
> ksycoca to get a mimetype's parent without having to load it completely".<br>
><br>
> > Attached patch adds fast path to<br>
> > KMimeType::is by allowing to ignore resolving aliases. It is not a<br>
> > problem in case of KFileItem, because application/x-desktop is not an<br>
> > alias.<br>
><br>
> Well, it is not at the moment, but who knows about the future?<br>
> Any mimetype could be turned into an alias later on in order to solve some<br>
> bug, like if we merge two mimetypes.<br>
><br>
> Also, this is solving the wrong problem IMHO. Resolving aliases _is_ fast,<br>
> since they are in a QMap in KMimeTypeFactory. The problem is just that<br>
> findMimeTypeByName does both: resolving aliases _and_ loading the mimetype,<br>
> which is the slow part. How about we resolve aliases without loading the<br>
> mimetype? This would solve this in a much nicer way - no need for new API,<br>
> the code would remain generic but just faster.<br>
><br>
> Can you check the performance with this new patch?<br>
> (This is orthogonal to my planned KMimeType::is() performance improvement<br>
> which would make it even faster, btw).<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Only slightly slower than my patch (~9% instead of ~7% CPU spent in KFileItem::iconName() ). But at least it is future-proof.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p></body></html>