[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Re: On Memory consumption of KDevelop-PG
From:       Alexander Dymo <alexander.dymo () gmail ! com>
Date:       2010-01-08 23:53:01
Message-ID: 201001090153.01982.alexander.dymo () gmail ! com
[Download RAW message or body]

> There is a few things we can do in future that would have a huge impact:
> - Replace size_t with uint everywhere within the parser
> - Move the "AST* parent" and "DUContext* ducontext" members out of the AST,
> into a separate map in ParseSession, as they are not needed in most cases.
> - Do the same thing with the "comments" member of CommentAST

I've tried to replace size_t with uint and remove AST*parent pointer. Here are 
the results:

== my test file ==
						heap total	heap peak
original:					506			399
with uint instead of size_t	459			351
without parent pointer		481			372

== kdevplatform ==
						heap total	heap peak
original:					7826		193
with uint instead of size_t	7640		193
without parent pointer		7790		193


Conclusions:
for my large C/C++ file we save:
size_t => uint: 			50M
removing parent pointer:	20M

Total 70M which is not bad - only 330M will be used during the parsing for 
that file.

For kdevplatform the peak memory consumption isn't changed because AST's are 
usually small and they are deleted when file is parsed. But these changes can 
save us some malloc/realloc calls. If you look at heap total, you'll see that 
we allocate 186M less after changing to uints and 36M less after removing 
parent pointer.
Total, we can allocate 222M less.

So, these optimizations wouldn't hurt at all. Shall I proceed and post patches 
for review?

-- 
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic