jpoelen added a comment.

  I just tried with a format containing 5000 `<RegExpr attribute="Keyword" 
context="\#stay" String="\baa\b"/>` rules. This gives 2000 to 6000 more 
allocation than with WordDetect. Same for StringDetect vs Detect2Chars.
  
  At the speed level, for a single rule and a file with 13 * 8000 `aa `, 
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.
  
  The memory test is done with `XDG_DATA_DIRS=$PWD memusage 
kate-syntax-highlighter x.aa >/dev/null`
  Speed one with `XDG_DATA_DIRS=$PWD /usr/bin/time --format="%Es - %MK" 
kate-syntax-highlighter x.aa >/dev/null`
  
  $PWD/org.kde.syntax-highlighting/syntax/aa.xml:
  
    <?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>

REPOSITORY
  R216 Syntax Highlighting

REVISION DETAIL
  https://phabricator.kde.org/D10621

To: jpoelen, dhaumann
Cc: vkrause, #framework_syntax_highlighting, dhaumann, #frameworks, michaelh, 
genethomas, ngraham, cullmann

Reply via email to