<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/129859/">https://git.reviewboard.kde.org/r/129859/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#e0e0e0" width="100%" cellpadding="12" style="border: 1px gray solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<h1 style="margin: 0; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for KDE Frameworks, David Faure, Daniel Vrátil, and Laurent Montel.</div>
<div>By Milian Wolff.</div>
<p style="color: grey;"><i>Updated Jan. 23, 2017, 7:03 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kcoreaddons
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">On my machine, the initial output is as follows for RelWithDebInfo:
PASS : KTextToHTMLTest::benchHtmlConvert(plain)
RESULT : KTextToHTMLTest::benchHtmlConvert():"plain":
4.0 msecs per iteration (total: 65, iterations: 16)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces":
3.4 msecs per iteration (total: 55, iterations: 16)
PASS : KTextToHTMLTest::benchHtmlConvert(highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"highlight-text":
4.2 msecs per iteration (total: 68, iterations: 16)
PASS : KTextToHTMLTest::benchHtmlConvert(replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"replace-smileys":
4.1 msecs per iteration (total: 66, iterations: 16)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text":
3.6 msecs per iteration (total: 58, iterations: 16)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text+replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text+replace-smileys":
3.5 msecs per iteration (total: 57, iterations: 16)
Replace heap-allocated list of chars with QStringLiteral
The main bottleneck in the benchmark for KTextToHTML was actually
constructing the temporary list of word-boundaries. Instead of
doing that all the time, use a QStringLiteral-constructed static
QString.
This improves the benchmarks by more than ~4x on my machine,
all compiled in RelWithDebInfo:
PASS : KTextToHTMLTest::benchHtmlConvert(plain)
RESULT : KTextToHTMLTest::benchHtmlConvert():"plain":
0.75 msecs per iteration (total: 96, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces":
0.71 msecs per iteration (total: 91, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"highlight-text":
0.89 msecs per iteration (total: 57, iterations: 64)
PASS : KTextToHTMLTest::benchHtmlConvert(replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"replace-smileys":
0.75 msecs per iteration (total: 96, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text":
0.79 msecs per iteration (total: 51, iterations: 64)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text+replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text+replace-smileys":
0.79 msecs per iteration (total: 51, iterations: 64)
Remove temporary string allocations
Instead of calling .mid() to compare to a QLatin1String,
call .midRef() as that won't allocate.
Improves the performance of the unit test by ~2x on my
machine when compiling in RelWithDebInfo:
PASS : KTextToHTMLTest::benchHtmlConvert(plain)
RESULT : KTextToHTMLTest::benchHtmlConvert():"plain":
0.40 msecs per iteration (total: 52, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces":
0.36 msecs per iteration (total: 93, iterations: 256)
PASS : KTextToHTMLTest::benchHtmlConvert(highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"highlight-text":
0.51 msecs per iteration (total: 66, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"replace-smileys":
0.41 msecs per iteration (total: 53, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text":
0.44 msecs per iteration (total: 57, iterations: 128)
PASS : KTextToHTMLTest::benchHtmlConvert(preserve-spaces+highlight-text+replace-smileys)
RESULT : KTextToHTMLTest::benchHtmlConvert():"preserve-spaces+highlight-text+replace-smileys":
0.46 msecs per iteration (total: 59, iterations: 128)
Mark some methods as const</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">the test still passes fine. note that the above is actually split into 4 commits locally</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>autotests/ktexttohtmltest.h <span style="color: grey">(3aaa5810d84ecb05b68b8a20b94bd281cfe3a6ba)</span></li>
<li>autotests/ktexttohtmltest.cpp <span style="color: grey">(fa8bbf261acd7b77ac502f14ca7820d3aeed7b55)</span></li>
<li>src/lib/text/ktexttohtml.cpp <span style="color: grey">(9b15cb27c7b9998971e2efbc198c3f840bf34959)</span></li>
<li>src/lib/text/ktexttohtml_p.h <span style="color: grey">(5e343485b26eb03ce2805f3a9f178a395f9b46a3)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/129859/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>