Review Request: Patch to reduce C++ parser memory consumption by removing parent AST pointer from AST nodes

David Nolden zwabel+reviewboard at gmail.com
Mon Feb 15 15:07:34 UTC 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2940/#review4161
-----------------------------------------------------------


I'm against removing this, because it is a functionality that is very useful. Yes we don't use it right now, but saving 8% of temporary-memory for one extreme test-case is IMO not enough motivation to completely remove this functionality.
That said, an alternative structure like a hash-map might be the better approach in long-term.

- David


On 2010-02-15 14:04:31, Alexander Dymo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2940/
> -----------------------------------------------------------
> 
> (Updated 2010-02-15 14:04:31)
> 
> 
> Review request for KDevelop, Bertjan Broeksema and David Nolden.
> 
> 
> Summary
> -------
> 
> We currently have AST *parent pointer in every AST node and it's never used in our code (I mean the release-ready code). Bertjan, I know that's something you wanted for your work, but maybe you can implement another way of storing parents (a map perhaps?). This unused pointer increases the size of AST and I'd like to avoid things like that as much as possible.
> 
> For my large C file, the peak memory consumption is reduced from 703M to 655M (-48M) by removing the parent pointer.
> 
> 
> Diffs
> -----
> 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/cppparsejob.cpp 1090158 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/parser/CMakeLists.txt 1090158 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parentvisitor.h 1090158 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parentvisitor.cpp 1090158 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parsesession.h 1090158 
>   /trunk/extragear/sdk/kdevelop/languages/cpp/parser/parsesession.cpp 1090158 
> 
> Diff: http://reviewboard.kde.org/r/2940/diff
> 
> 
> Testing
> -------
> 
> All tests pass.
> 
> 
> Thanks,
> 
> Alexander
> 
>





More information about the KDevelop-devel mailing list