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

List:       kde-bugs-dist
Subject:    [Bug 291248] kdevelop crashes when parsing big qrc files
From:       Milian Wolff <mail () milianw ! de>
Date:       2012-03-01 0:23:45
Message-ID: E1S2to9-0000kI-G2 () bugs ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=291248





--- Comment #9 from Milian Wolff <mail milianw de>  2012-03-01 00:23:45 ---
Git commit 79edb4115f9950a98dd395a05a45f391e19bd0e3 by Milian Wolff.
Committed on 01/03/2012 at 01:16.
Pushed by mwolff into branch 'master'.

optimize: reduce memory consumption of Token class by 50% on 64Bit

By removing the ParseSession pointer from it, we get rid of 8 bytes
and furthermore reduce the alignment size to 4. This way, we now
only require 12 bytes per token compared to 24 bytes previously.

This also allows us to define the Token class as a primitive type,
potentially speeding up the TokenStream even further.

The "cost" is a changed API, to get the string representation of
a token, one must now ask the TokenStream. In practice this is very
rarely a real pita, as before one often did

stream->token(i)->symbol()

now you just do

stream->symbol(i)

Furthermore I've consolidated the tons of custom "AST* node to QString"
functions into one central ParseSession::stringForNode.

Finally, I've replaced some costly token.symbol() == IndexedChar("somechar")
with the much faster token.kind == Token_xyz comparisons.

All in all, this should a) make our code faster and b) let it use much
less memory while at it. For the big resource file in the bug below,
the difference of 50% in the Token class results in ~250MB less memory
consumption

M  +4    -4    languages/cpp/cppduchain/cppeditorintegrator.cpp
M  +2    -2    languages/cpp/cppduchain/declarationbuilder.cpp
M  +1    -7    languages/cpp/cppduchain/dumpchain.cpp
M  +7    -11   languages/cpp/cppduchain/expressionvisitor.cpp
M  +6    -23   languages/cpp/cppduchain/name_visitor.cpp
M  +3    -2    languages/cpp/parser/codegenerator.cpp
M  +3    -3    languages/cpp/parser/dumptree.cpp
M  +35   -38   languages/cpp/parser/lexer.cpp
M  +53   -21   languages/cpp/parser/lexer.h
M  +7    -22   languages/cpp/parser/name_compiler.cpp
M  +6    -11   languages/cpp/parser/parser.cpp
M  +15   -0    languages/cpp/parser/parsesession.cpp
M  +10   -0    languages/cpp/parser/parsesession.h
M  +15   -5    languages/cpp/parser/tests/test_generator.cpp
M  +2    -11   languages/cpp/parser/tests/test_parser.cpp
M  +0    -4    languages/cpp/parser/tests/test_parser.h
M  +2    -2    languages/cpp/parser/tests/test_parser_cpp2011.cpp
M  +3    -2    languages/cpp/tests/cpp-parser.cpp

http://commits.kde.org/kdevelop/79edb4115f9950a98dd395a05a45f391e19bd0e3

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

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