Apple - Why do downloads (storedownloadd) from the Mac App Store consume so much CPU?
Ran into the same issue today when updating XCode: storedownloadd
pegs a CPU core for 20 minutes.
I tried breaking into storedownloadd with a debugger and saw some really long stack traces and a lot of time spent inside Security::CodeSigning
.
I suspect that it is recursively verifying the digital signatures of a lot of tiny files one-by-one. I have no idea why it would do that instead of verifying the whole package as it is being downloaded. I also see a lot of string manipulation inside Security_CodeSigning::RequirementLexer::RequirementLexer
.
Whatever storedownloadd
does, it is too damn slow!
The CPU usage is caused by both sloppy coding and encryption/decompressing. Engineers have become very careless with our CPU in the age of quad core notebooks with eight virtual cores.
Someone should chase Apple around about optimising the storedownloadd
routine. Considering that we had to put up with broken networking for over a year until Apple replaced the broken by design discoveryd
with mDNSresponder
.
Darker thoughts might suggest that the store is also compressing data for upload and sending it. Microsoft was caught out doing this many times but I haven't seen a documented case in Apple's case.
just killed it in terminal ;-) ...taking 1.5MB/s from my slow broadband
killall storedownloadd