Fix a major performance regression with article fetching/creation by not using implicit hashing — use explicit and simpler hashValue that will still provide high quality.

This commit is contained in:
Brent Simmons 2018-09-02 12:36:46 -07:00
parent fdb159a61b
commit 0e5051b060
2 changed files with 7 additions and 1 deletions

View File

@ -27,7 +27,10 @@ public struct Article: Hashable {
public let authors: Set<Author>?
public let attachments: Set<Attachment>?
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<Author>?, attachments: Set<Attachment>?, status: ArticleStatus) {
self.accountID = accountID

View File

@ -28,6 +28,9 @@ struct DatabaseArticle: Hashable {
let datePublished: Date?
let dateModified: Date?
let status: ArticleStatus
var hashValue: Int {
return articleID.hashValue
}
}