<table><tr><td style="">jpoelen added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10621">View Revision</a></tr></table><br /><div><div><p>I just tried with a format containing 5000 <tt style="background: #ebebeb; font-size: 13px;"><RegExpr attribute="Keyword" context="\#stay" String="\baa\b"/></tt> rules. This gives 2000 to 6000 more allocation than with WordDetect. Same for StringDetect vs Detect2Chars.</p>

<p>At the speed level, for a single rule and a file with 13 * 8000 <tt style="background: #ebebeb; font-size: 13px;">aa </tt>, WordDetect is 10% faster, but there is no difference between StringDetect and Detect2Chars. On the other hand, the more the number of rule increases the more the difference is important, even between StringDetect and Detect2Chars. 5000 times the same rule is extremely slow.</p>

<p>The memory test is done with <tt style="background: #ebebeb; font-size: 13px;">XDG_DATA_DIRS=$PWD memusage kate-syntax-highlighter x.aa >/dev/null</tt><br />
Speed one with <tt style="background: #ebebeb; font-size: 13px;">XDG_DATA_DIRS=$PWD /usr/bin/time --format="%Es - %MK" kate-syntax-highlighter x.aa >/dev/null</tt></p>

<p>$PWD/org.kde.syntax-highlighting/syntax/aa.xml:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="AAAA" section="Configuration" extensions="*.aa" mimetype="" version="3" kateversion="2.4" author="jo" license="LGPL">
<highlighting>
<contexts>
 <context name="ini" attribute="Normal Text" lineEndContext="#stay">
   <StringDetect attribute="Keyword" context="#stay" String="aa" />
   <!-- <Detect2Chars attribute="Keyword" context="#stay" char="a" char1="a" /> -->
   <!-- <WordDetect attribute="Keyword" context="#stay" String="aa" /> -->
   <!-- <RegExpr attribute="Keyword" context="#stay" String="\baa\b" /> -->
 </context>
</contexts>
<itemDatas>
 <itemData name="Normal Text" defStyleNum="dsDataType" />
 <itemData name="Keyword" defStyleNum="dsKeyword" />
</itemDatas>
</highlighting>
</language></pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10621">https://phabricator.kde.org/D10621</a></div></div><br /><div><strong>To: </strong>jpoelen, dhaumann<br /><strong>Cc: </strong>vkrause, Framework: Syntax Highlighting, dhaumann, Frameworks, michaelh, genethomas, ngraham, cullmann<br /></div>