Optimizing our URL usage

Milian Wolff mail at milianw.de
Thu Nov 29 16:59:29 UTC 2012


# second attempt to check whether this mail comes through now ... #

Hey all,

profiling KDevelop is my hobby, you know that :) And since some time I had the 
feeling that KUrl is just too inefficient to be used for storing our project 
model data.

In the sharedurls branch of KDevplatform you can now find my take on an 
optimized data structure for URLs in KDevelop.

The idea is simple:

/foo/
/foo/bar/
/foo/bar/asdf.txt

If you store these three paths in three KUrls, you will not share any memory. 
My data structure will share the segments, thus you only keep "foo", "bar" and 
"asdf.txt" in memory. This is even nicer when we think about our project 
model, where we also store the file name in a separate QString, which again is 
not sharing any data with the KUrl. My data type would easily allow this to be 
shared as well, further decreasing the memory consumption.

There are a few open questions which I will investigate in the following days, 
but I'd like to see any kind of feedback even now:

- what is a good name for this data type, I would personally prefer 
KDevelop::URL
- how often do we need an actual KUrl instance, the conversion migh be 
potentially slow. personally, I don't see too many instances where we need 
actual KUrl's though. Only when opening a file (which is far slower than the 
conversion) or similar.
- the API changes required might be quite pervasive... do we want something 
like that Maybe something we should tackle with 4.6?
- while at it, we might also want to introduce an IndexedUrl which I think 
could be done in a more efficient manner compared to the usual Url -> String -
> Indexed -> String -> Url roundtrip.

Now the somewhat ugly issues

What about more esoteric URLs, e.g. containing fragment (#...), queries 
(?...), passwords, ... you name it. Do we want to support them? Personally, I 
don't think so. We only operate on files here, and while they might be remote, 
they should not have any "logic" which would require fragments or queries. And 
passwords should imo be stored by KIO/KWallet.

Cheers
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121129/08bb013f/attachment.sig>


More information about the KDevelop-devel mailing list