improve performance of Rule::isWordDelimiter and KeywordListRule::doMatch
ClosedPublic

Authored by cullmann on Aug 28 2018, 4:54 PM.

Details

Test Plan

make && make test

before, perf tells for

perf record -g ./bin/htmlhighlighter_test

> Rule::match 40% & KeywordListRule::doMatch 26%

after the patch

> Rule::match 17% & KeywordListRule::doMatch 4.5%

binary search was slower, contains is much faster on the VERY small strings

Diff Detail

Repository
R216 Syntax Highlighting
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cullmann created this revision.Aug 28 2018, 4:54 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 28 2018, 4:54 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
cullmann requested review of this revision.Aug 28 2018, 4:54 PM

And yes, you see even the costs for the auto defData = DefinitionData::get(m_def.definition()); as a high percentage, close to the total costs of KeywordListRule::doMatch now.

cullmann updated this revision to Diff 40572.Aug 28 2018, 5:05 PM

optimize html exporter, 23% => 15% of runtime for applyFormat in unit test

cullmann updated this revision to Diff 40573.Aug 28 2018, 5:13 PM

add my copyright, too

vkrause accepted this revision.Aug 28 2018, 5:32 PM

Very nice, thank you!

This revision is now accepted and ready to land.Aug 28 2018, 5:32 PM
This revision was automatically updated to reflect the committed changes.