Getting rid of global objects in kdevplatform/language

Andreas Pakulat apaku at gmx.de
Thu May 13 22:41:34 UTC 2010


Hi,

so as this is now a _lot_ easier to manage (for me at least) with git I
went ahead and replaced all objects that were created outside of any
function in the language/ code with a function call creating a
function-static object and returning a reference (or pointer where
apropriate). No big problems there, I've published the branch
(remove_duchain_static) for kdevplatform and kdevelop in my team-clones
on gitorious.org (see the Repository clones list on
http://gitorious.org/+kdevelop-developers/).  That way everybody can
test the changes on his personal pet-project.

David said that this would severly reduce the parsing time, so obviously
the next step was to check how much slower the code is now when parsing
sources. I've taken the kdevplatform source dir and added the attached
.kdev_include_paths file. I've built both kdevplatform and kdevelop in
release mode and exported a dummy-session-id so I get a clean
duchain-dir that I can easily delete. My "performance test" was this:

export KDEV_SESSION=duchainify
rm -rf $HOME/.kdevduchain/duchainify
time duchainify ---f all-declarations-and-uses-and-AST /home/andreas/src/kdevplatform

Which (to my knowledge) parses all sources of kdevplatform and included
headers.

The results for the release mode are:
with global/static objects (i.e. current master)
        Run 1        Run 2        Run 3        Average
real    1m40.875s    1m40.048s    1m40.119s    1m40.348s
user    1m34.326s    1m33.210s    1m34.082s    1m33.873s
sys     0m5.028s     0m4.924s     0m5.152s     0m5.026s

without global/static objects (i.e. remove_duchain_static branch)
real    1m41.011s    1m42.709s    1m42.222s    1m41.980s
user    1m34.934s    1m37.002s    1m35.546s    1m35.830s
sys     0m4.652s     0m5.084s     0m5.212s     0m4.983s

If somebody finds a flaw in this (not very scientific) performance test
please tell me and I'll be happy to improve it.

With these numbers I'd like to merge the branch into master which will
allow for a couple of nice improvements:

- the QFSFileEngine::map() warning is gone, which might help with some
  of the crash-reports we have (as some are related to mmap-stuff)
- No .bin binary anymore, just a single kdevelop executable
- no environment variable needed anymore
- The inline-code in the sessioncontroller, that is also partly copied
  can be made non-inline again
- We can move the duchain-data into the session-directory as we can use
  KDE API in the repositories
- portability to other platforms, this stems from other platforms
  possibly having other initialization orders
- probably more stuff I can't remember right now

Opinions?

Andreas

PS: I've also tested debug-mode and there the difference is even
smaller, in fact sometimes the parsing with the branch was faster.

-- 
You're not my type.  For that matter, you're not even my species!!!




More information about the KDevelop-devel mailing list