Don't unnecessarily copy image data in the Downloader Operation

In the DownloaderOperation, we were copying the image data to an NSData, then immediately unassigning the imageData property. Presumably, this was done to prevent the imageData that would be decoded from having additional data added to it while we were decoding it. However, by unassigning the only other reference to it, we already prevented that.
In the SDImageIOCoders, use NSData-initWithData to allow the class cluster to hopefully prevent an unnecessary copy of the data
This commit is contained in:
Rachel Brindle 2021-02-01 18:01:06 -08:00
parent 4aaca57fb2
commit 60de72aa5b
1 changed files with 1 additions and 1 deletions

View File

@ -452,7 +452,7 @@ didReceiveResponse:(NSURLResponse *)response
[self done]; [self done];
} else { } else {
if ([self callbacksForKey:kCompletedCallbackKey].count > 0) { if ([self callbacksForKey:kCompletedCallbackKey].count > 0) {
NSData *imageData = [self.imageData copy]; NSData *imageData = self.imageData;
self.imageData = nil; self.imageData = nil;
// data decryptor // data decryptor
if (imageData && self.decryptor) { if (imageData && self.decryptor) {