perf: virtualize LUT directory rows as well as thumbnails for large libraries
这个提交包含在:
1 父节点
87baa785fd
当前提交
838037a7e0
4 个文件已更改
+45
-21
没有与搜索条件相匹配的文件
@@ -69,12 +69,18 @@ int main(int argc,const char *argv[]) {@autoreleasepool {
|
||||
// Real browser objects, never shown; its grid should represent thousands of
|
||||
// files with only visible/overscan buttons, including after a distant scroll.
|
||||
NSURL *catalog=[destination URLByAppendingPathComponent:@"Catalog" isDirectory:YES];[fm createDirectoryAtURL:catalog withIntermediateDirectories:NO attributes:nil error:&error];
|
||||
BOOL catalogOK=YES;for(NSUInteger i=0;i<3000;i++){NSString *path=[catalog.path stringByAppendingPathComponent:[NSString stringWithFormat:@"Catalog-%04lu.cube",(unsigned long)i]];if(link(anchor.path.fileSystemRepresentation,path.fileSystemRepresentation)!=0){catalogOK=NO;break;}}require(catalogOK,@"3000 catalog fixtures created");
|
||||
BOOL catalogOK=YES;for(NSUInteger i=0;i<3000;i++){
|
||||
NSString *folder=[destination.path stringByAppendingPathComponent:[NSString stringWithFormat:@"Folder-%04lu",(unsigned long)i]];
|
||||
if(![fm createDirectoryAtPath:folder withIntermediateDirectories:NO attributes:nil error:&error]){catalogOK=NO;break;}
|
||||
NSString *path=[folder stringByAppendingPathComponent:[NSString stringWithFormat:@"Catalog-%04lu.cube",(unsigned long)i]];
|
||||
if(link(anchor.path.fileSystemRepresentation,path.fileSystemRepresentation)!=0){catalogOK=NO;break;}
|
||||
}require(catalogOK,@"3000 catalog files in independent folders created");
|
||||
[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||
NSMutableArray *selected=[NSMutableArray array];
|
||||
DYLUTBrowser *browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:^(NSString *path){[selected addObject:path?:@""];}];
|
||||
pump(^{return [browser valueForKey:@"libraryTask"]==nil;});
|
||||
NSUInteger visible=[[browser valueForKey:@"visibleEntries"]count],tileCount=[[browser valueForKey:@"tiles"]count];
|
||||
require([[browser valueForKey:@"folderPaths"]count]>3000&&[[browser valueForKey:@"folderButtons"]count]<30,@"large directory list creates only visible folder controls");
|
||||
require(visible==3025&&tileCount>0&&tileCount<200,@"large catalog creates only visible thumbnail controls");
|
||||
NSScrollView *scroll=[browser valueForKey:@"gridScroll"];[scroll.contentView scrollToPoint:NSMakePoint(0,scroll.documentView.frame.size.height-scroll.contentSize.height)];[browser layoutBrowser];
|
||||
require([[browser valueForKey:@"tiles"]count]<200,@"scrolling keeps thumbnail view count bounded");
|
||||
@@ -85,9 +91,10 @@ int main(int argc,const char *argv[]) {@autoreleasepool {
|
||||
require(selected.count==1&&[selected.lastObject isEqual:keys[1]],@"rapid selection applies only the latest LUT");
|
||||
[browser thumbnailClicked:tiles[keys[0]]];[browser clearSelection:nil];pump(^{return [browser valueForKey:@"selectionTask"]==nil;});
|
||||
require([selected.lastObject isEqual:@""],@"clear selection supersedes pending LUT application");
|
||||
NSUInteger folderViews=[[browser valueForKey:@"folderButtons"]count];
|
||||
[browser importSelectedURLs:@[source]];[browser close];done=NO;[library reloadAsync:^(NSError *failure){require(!failure,@"scan after browser close completes");done=YES;}];pump(^{return done;});
|
||||
require(library.entries.count==3025,@"closing during import cancels without changing existing library");
|
||||
[browser release];report[@"largeCatalogEntries"]=@(visible);report[@"initialLiveThumbnailViews"]=@(tileCount);report[@"pass"]=@YES;
|
||||
[browser release];report[@"largeCatalogEntries"]=@(visible);report[@"initialLiveThumbnailViews"]=@(tileCount);report[@"initialLiveFolderViews"]=@(folderViews);report[@"pass"]=@YES;
|
||||
#else
|
||||
report[@"mode"]=@"baseline synchronous import";
|
||||
#endif
|
||||
|
||||
在新工单中引用
屏蔽一个用户