From 0e5051b0606350de2f1a8d114415a6b2003093b8 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 2 Sep 2018 12:36:46 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20a=20major=20performance=20regression=20wi?= =?UTF-8?q?th=20article=20fetching/creation=20by=20not=20using=20implicit?= =?UTF-8?q?=20hashing=20=E2=80=94=C2=A0use=20explicit=20and=20simpler=20ha?= =?UTF-8?q?shValue=20that=20will=20still=20provide=20high=20quality.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/Articles/Article.swift | 5 ++++- Frameworks/ArticlesDatabase/DatabaseArticle.swift | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Frameworks/Articles/Article.swift b/Frameworks/Articles/Article.swift index 1a6b17c0b..32368f21c 100644 --- a/Frameworks/Articles/Article.swift +++ b/Frameworks/Articles/Article.swift @@ -27,7 +27,10 @@ public struct Article: Hashable { public let authors: Set? public let attachments: Set? public let status: ArticleStatus - + public var hashValue: Int { + return articleID.hashValue + } + public init(accountID: String, articleID: String?, feedID: String, uniqueID: String, title: String?, contentHTML: String?, contentText: String?, url: String?, externalURL: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, authors: Set?, attachments: Set?, status: ArticleStatus) { self.accountID = accountID diff --git a/Frameworks/ArticlesDatabase/DatabaseArticle.swift b/Frameworks/ArticlesDatabase/DatabaseArticle.swift index 1d283eacc..7a8d22acf 100644 --- a/Frameworks/ArticlesDatabase/DatabaseArticle.swift +++ b/Frameworks/ArticlesDatabase/DatabaseArticle.swift @@ -28,6 +28,9 @@ struct DatabaseArticle: Hashable { let datePublished: Date? let dateModified: Date? let status: ArticleStatus + var hashValue: Int { + return articleID.hashValue + } }