<table><tr><td style="">dkurz 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/D7107" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>So now we have readability, memory safety and performance on the plus side. To further back my performance claim, [1] investigates the difference between stack and heap allocation. Short answer: depends on the platform, but stack allocation can easily be faster by two orders of magnitude for a simple single-threaded program. KMail is multithreaded, so we can expect bigger differences: Heap allocation causes threads to synchronize on most platforms, because the heap is a shared resource (see e.g. [2]). The kind of allocation also hints at the expected lifetime of an object (in C++; in Qt, this is somewhat questionable).</p>
<p>[1] <a href="https://stackoverflow.com/questions/161053/which-is-faster-stack-allocation-or-heap-allocation" class="remarkup-link" target="_blank" rel="noreferrer">https://stackoverflow.com/questions/161053/which-is-faster-stack-allocation-or-heap-allocation</a><br />
[2] <a href="https://stackoverflow.com/questions/1665419/do-threads-have-a-distinct-heap" class="remarkup-link" target="_blank" rel="noreferrer">https://stackoverflow.com/questions/1665419/do-threads-have-a-distinct-heap</a></p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R206 KMail</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7107" rel="noreferrer">https://phabricator.kde.org/D7107</a></div></div><br /><div><strong>To: </strong>dkurz, KDE PIM: KMail<br /><strong>Cc: </strong>dvratil, mlaurent, KDE PIM, dvasin, winterz, vkrause, knauss<br /></div>