perf(ivy): guard host binding execution with a TNode flag (#33102)

Based on the results of the `directive_instantiate` executing host
bindings logic (in creation mode) account for ~23% of time spent in
the directive instantiation, even if a directive doesn't have host
bindings! This is clearly wastful hence a new flag.

PR Close #33102
This commit is contained in:
Pawel Kozlowski
2019-10-11 16:38:07 +02:00
committed by Miško Hevery
parent dcca80bb1e
commit d4d07233dc
3 changed files with 21 additions and 12 deletions

View File

@ -46,30 +46,37 @@ export const enum TNodeType {
*/
export const enum TNodeFlags {
/** This bit is set if the node is a host for any directive (including a component) */
isDirectiveHost = 0b00000001,
isDirectiveHost = 0b000000001,
/**
* This bit is set if the node is a host for a component. Setting this bit implies that the
* isDirectiveHost bit is set as well. */
isComponentHost = 0b00000010,
isComponentHost = 0b000000010,
/** This bit is set if the node has been projected */
isProjected = 0b00000100,
isProjected = 0b000000100,
/** This bit is set if any directive on this node has content queries */
hasContentQuery = 0b00001000,
hasContentQuery = 0b000001000,
/** This bit is set if the node has any "class" inputs */
hasClassInput = 0b00010000,
hasClassInput = 0b000010000,
/** This bit is set if the node has any "style" inputs */
hasStyleInput = 0b00100000,
hasStyleInput = 0b000100000,
/** This bit is set if the node has initial styling */
hasInitialStyling = 0b01000000,
hasInitialStyling = 0b001000000,
/** This bit is set if the node has been detached by i18n */
isDetached = 0b10000000,
isDetached = 0b010000000,
/**
* This bit is set if the node has directives with host bindings. This flags allows us to guard
* host-binding logic and invoke it only on nodes that actually have directives with host
* bindings.
*/
hasHostBindings = 0b100000000,
}
/**