mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Make yoga & layout specs faster by eliminating some copies (#1128)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#import <numeric>
|
||||
#import <vector>
|
||||
|
||||
#import <AsyncDisplayKit/ASCollections.h>
|
||||
#import <AsyncDisplayKit/ASDimension.h>
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
#import <AsyncDisplayKit/ASLayoutElement.h>
|
||||
@@ -151,12 +152,14 @@
|
||||
self.style.ascender = stackChildren.front().style.ascender;
|
||||
self.style.descender = stackChildren.back().style.descender;
|
||||
}
|
||||
|
||||
const auto sublayouts = [[NSMutableArray<ASLayout *> alloc] init];
|
||||
|
||||
ASLayout *rawSublayouts[positionedLayout.items.size()];
|
||||
int i = 0;
|
||||
for (const auto &item : positionedLayout.items) {
|
||||
[sublayouts addObject:item.layout];
|
||||
rawSublayouts[i++] = item.layout;
|
||||
}
|
||||
|
||||
let sublayouts = [NSArray<ASLayout *> arrayByTransferring:rawSublayouts count:i];
|
||||
return [ASLayout layoutWithLayoutElement:self size:positionedLayout.size sublayouts:sublayouts];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user