D11487: optimization of TextLineData::attribute
Milian Wolff
noreply at phabricator.kde.org
Fri Mar 23 20:15:10 UTC 2018
mwolff added a comment.
@jtamate I just checked, the function is called with the same parameters for me locally. What output do you get for this:
diff --git a/src/spellcheck/spellcheck.cpp b/src/spellcheck/spellcheck.cpp
index 9e04d788..50e92885 100644
--- a/src/spellcheck/spellcheck.cpp
+++ b/src/spellcheck/spellcheck.cpp
@@ -133,6 +133,7 @@ QList<QPair<KTextEditor::Range, QString> > KateSpellCheckManager::spellCheckWrtH
bool singleLine,
bool returnSingleRange)
{
+ qDebug() << range << dictionary << singleLine << returnSingleRange;
QList<QPair<KTextEditor::Range, QString> > toReturn;
if (range.isEmpty()) {
return toReturn;
@@ -172,6 +173,7 @@ QList<QPair<KTextEditor::Range, QString> > KateSpellCheckManager::spellCheckWrtH
}
const int start = (line == startLine) ? startColumn : 0;
const int end = (line == endLine) ? endColumn : kateTextLine->length();
+ qDebug() << line << kateTextLine->attributesList().size() << (end - start);
for (int i = start; i < end;) { // WARNING: 'i' has to be incremented manually!
int attr = kateTextLine->attribute(i);
const KatePrefixStore &prefixStore = highlighting->getCharacterEncodingsPrefixStore(attr);
For me this is the interesting bit:
15.097 debug: unknown[unknown:0]: [ (0, 0) -> (0, 358720) ] "" true false
15.097 debug: unknown[unknown:0]: 0 1979 358720
23.013 debug: unknown[unknown:0]: [ (5, 0) -> (5, 162682) ] "" true false
23.013 debug: unknown[unknown:0]: 5 12 162682
So for line 0 I should actually get quite abysmal performance too, worst case 1979 * 358720, but it flies right through here... Now I wonder what kind of CPU you are using? I have a i7-5600U CPU @ 2.60GHz here in my laptop, which has:
$ lstopo --of console
Machine (11GB)
Package L#0 + L3 L#0 (4096KB)
L2 L#0 (256KB) + L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0
PU L#0 (P#0)
PU L#1 (P#1)
L2 L#1 (256KB) + L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1
PU L#2 (P#2)
PU L#3 (P#3)
The 1979 entries of attributes (each 12byte large) produce ~24KB of data, which fits nicely within my L1 cache. Maybe I'm just lucky and this is what hides this issue from me?
REPOSITORY
R39 KTextEditor
REVISION DETAIL
https://phabricator.kde.org/D11487
To: jtamate, #frameworks, #kate, cullmann
Cc: anthonyfieroni, dhaumann, mwolff, cullmann, michaelh, kevinapavew, ngraham, demsking, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180323/a6df2c20/attachment.html>
More information about the Kde-frameworks-devel
mailing list