From 7b40ca221bdd791e048f4907eaec9a754ce04f9e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 13 May 2019 22:16:44 -0700 Subject: [PATCH] Use the articleID + accountID as a key for truncated summaries. This is *way* faster than using the entire body. It avoids a hash of a long string. (Note: we still need to toss the cache at the appropriate time.) --- Shared/Timeline/TimelineStringFormatter.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Shared/Timeline/TimelineStringFormatter.swift b/Shared/Timeline/TimelineStringFormatter.swift index 2f4503cfe..c066ab0d1 100644 --- a/Shared/Timeline/TimelineStringFormatter.swift +++ b/Shared/Timeline/TimelineStringFormatter.swift @@ -85,7 +85,8 @@ struct TimelineStringFormatter { return "" } - if let cachedBody = summaryCache[body] { + let key = article.articleID + article.accountID + if let cachedBody = summaryCache[key] { return cachedBody } var s = body.rsparser_stringByDecodingHTMLEntities() @@ -95,7 +96,7 @@ struct TimelineStringFormatter { if s == "Comments" { // Hacker News. s = "" } - summaryCache[body] = s + summaryCache[key] = s return s }