Revision: 22581
http://sourceforge.net/p/bibdesk/svn/22581
Author: hofman
Date: 2018-09-11 09:52:49 +0000 (Tue, 11 Sep 2018)
Log Message:
-----------
Use group name for hash of category group, or we get too many groups with the
same hash, making the outline view's hash table extremely slow. Make author
isEqual more efficient.
Modified Paths:
--------------
trunk/bibdesk/BDSKCategoryGroup.m
trunk/bibdesk/BibAuthor.m
Modified: trunk/bibdesk/BDSKCategoryGroup.m
===================================================================
--- trunk/bibdesk/BDSKCategoryGroup.m 2018-09-11 06:30:27 UTC (rev 22580)
+++ trunk/bibdesk/BDSKCategoryGroup.m 2018-09-11 09:52:49 UTC (rev 22581)
@@ -106,8 +106,9 @@
}
// name can change, but key doesn't change, and it's also required for equality
+// but having a lot of groups with the same hash leads to problems in the
outline view's internal hash table
- (NSUInteger)hash {
- return [key hash];
+ return [key hash] + 31 * [[self name] hash];
}
- (BOOL)isEqual:(id)other {
@@ -115,9 +116,9 @@
return YES;
if (NO == [other isMemberOfClass:[self class]])
return NO;
- if (NO == [[self name] isEqual:[(BDSKGroup *)other name]])
+ if ([[self key] isEqualToString:[other key]] == NO && ([self key] != nil
|| [other key] != nil))
return NO;
- return [[self key] isEqualToString:[other key]] || ([self key] == nil
&& [other key] == nil);
+ return [[self name] isEqual:[(BDSKGroup *)other name]];
}
- (NSString *)description {
Modified: trunk/bibdesk/BibAuthor.m
===================================================================
--- trunk/bibdesk/BibAuthor.m 2018-09-11 06:30:27 UTC (rev 22580)
+++ trunk/bibdesk/BibAuthor.m 2018-09-11 09:52:49 UTC (rev 22581)
@@ -164,10 +164,12 @@
return [encoder isByref] ? (id)[NSDistantObject proxyWithLocal:self
connection:[encoder connection]] : self;
}
-- (BOOL)isEqual:(id)obj{
- if (![obj isKindOfClass:[self class]])
+- (BOOL)isEqual:(id)other{
+ if (self == other)
+ return YES;
+ if (NO == [other isMemberOfClass:[self class]])
return NO;
- return obj == self ? YES : [normalizedName isEqualToString:[obj
normalizedName]];
+ return [normalizedName isEqualToString:[other normalizedName]];
}
- (NSUInteger)hash{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit