• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads


  • Subject: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
  • From: Allan Odgaard via Cocoa-dev <email@hidden>
  • Date: Sun, 19 Apr 2020 22:08:42 +0700

Starting with macOS 10.15 I have noticed that obtaining NSURLLocalizedNameKey, NSURLTagNamesKey, and even calling getxattr(), can cause a significant delay.

The code below, which gets NSURLLocalizedNameKey for 3 folders, takes 1.9 seconds to execute on my system.

It appears though that it is only these 3 specific folders that has the problem.

Furthermore, the problem only happens when I include the code below in a GUI application which is launched via launch services. If I run the executable directly from a terminal then the code is near instant.

I tried to sample the code, and it appears that it calls out to some OS service/daemon. Presumably it never gets a response, and a timeout is triggered.

I wonder if anyone else has come across this? And maybe have discovered more info?

This is btw macOS 10.15.4 and a fairly stock system (new computer without migrating old data), and I noticed the problem some time ago, so it definitely existed before 10.15.4, but I never saw anything like this before upgrading to Catelina.

    NSTimeInterval startTime = NSDate.timeIntervalSinceReferenceDate;

    NSArray<NSURL*>* urls = @[]
[NSFileManager.defaultManager URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil],, [NSFileManager.defaultManager URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil] [NSFileManager.defaultManager URLForDirectory:NSDownloadsDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil,
    ];

    NSString* localizedName;
    for(NSURL* url in urls)
[url getResourceValue:&localizedName forKey:NSURLLocalizedNameKey error:nil];

NSLog(@"Duration %.03f", NSDate.timeIntervalSinceReferenceDate - startTime);
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
      • From: "David M. Cotter via Cocoa-dev" <email@hidden>
  • Prev by Date: Re: Creating OpenSSH compatible key pairs
  • Next by Date: Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
  • Previous by thread: Re: Creating OpenSSH compatible key pairs
  • Next by thread: Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
  • Index(es):
    • Date
    • Thread