TextEditor: Spare unneeded lookups

When deleting text marks from the cache we can safely
assume that each mark is unique.
This significantly reduces the time of cleaning up the
marks cache when having lots of marks which may happen
e.g. for Axivion analyses.

Change-Id: I185cf0696cc603afb773d50fdfbaee84df9b2e20
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2024-10-01 15:40:53 +02:00
parent b1a9eeaea5
commit 137538a994

View File

@@ -1034,7 +1034,7 @@ void TextDocument::removeMarkFromMarksCache(TextMark *mark)
{ {
auto documentLayout = qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout()); auto documentLayout = qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
QTC_ASSERT(documentLayout, return); QTC_ASSERT(documentLayout, return);
d->m_marksCache.removeAll(mark); d->m_marksCache.removeOne(mark);
auto scheduleLayoutUpdate = [documentLayout](){ auto scheduleLayoutUpdate = [documentLayout](){
// make sure all destructors that may directly or indirectly call this function are // make sure all destructors that may directly or indirectly call this function are