mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Measure performance for ASCellNode layout (#2209)
* Measure performance for ASCellNode layout * Address Adlai and Levi's feedback: * Move to ASDisplayNode level * Lock around setting/getting measurement options and results * Record all measurement passes and report times as an array * Only add relevant entries to the performanceMetrics dictionary * Rebase * Store sum and count instead of array * Rename ScopeTimerDataPoint to ScopeTimerSum * Address Levi's feedback * Address Adlai's feedback
This commit is contained in:
committed by
Adlai Holler
parent
8c2f3f666f
commit
59fbfb682d
@@ -18,6 +18,22 @@ void ASPerformBlockOnMainThread(void (^block)());
|
||||
void ASPerformBlockOnBackgroundThread(void (^block)()); // DISPATCH_QUEUE_PRIORITY_DEFAULT
|
||||
ASDISPLAYNODE_EXTERN_C_END
|
||||
|
||||
/**
|
||||
* Bitmask to indicate what performance measurements the cell should record.
|
||||
*/
|
||||
typedef NS_OPTIONS(NSUInteger, ASDisplayNodePerformanceMeasurementOptions) {
|
||||
ASDisplayNodePerformanceMeasurementOptionLayoutSpec = 1 << 0,
|
||||
ASDisplayNodePerformanceMeasurementOptionLayoutGeneration = 1 << 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Keys to retrieve performance entries from the performance dictionary.
|
||||
*/
|
||||
extern NSString *const ASDisplayNodeLayoutSpecTotalTimeKey;
|
||||
extern NSString *const ASDisplayNodeLayoutSpecNumberOfPassesKey;
|
||||
extern NSString *const ASDisplayNodeLayoutGenerationTotalTimeKey;
|
||||
extern NSString *const ASDisplayNodeLayoutGenerationNumberOfPassesKey;
|
||||
|
||||
@interface ASDisplayNode (Beta)
|
||||
|
||||
/**
|
||||
@@ -57,6 +73,17 @@ ASDISPLAYNODE_EXTERN_C_END
|
||||
*/
|
||||
@property (nonatomic, copy, nullable) ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext;
|
||||
|
||||
/**
|
||||
* @abstract A bitmask representing which actions (layout spec, layout generation) should be measured.
|
||||
*/
|
||||
@property (nonatomic, assign) ASDisplayNodePerformanceMeasurementOptions measurementOptions;
|
||||
|
||||
/**
|
||||
* @abstract A dictionary representing performance measurements collected.
|
||||
* @note see the constants above to retrieve relevant performance measurements
|
||||
*/
|
||||
@property (nonatomic, strong, readonly) NSDictionary *performanceMeasurements;
|
||||
|
||||
/** @name Layout Transitioning */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user