perf(ivy): move local references into consts array (#33129)
Follow-up from #32798. Moves the local references array into the component def's `consts` in order to make it compress better. Before: ``` const _c0 = ['foo', '']; SomeComp.ngComponentDef = defineComponent({ template: function() { element(0, 'div', null, _c0); } }); ``` After: ``` SomeComp.ngComponentDef = defineComponent({ consts: [['foo', '']], template: function() { element(0, 'div', null, 0); } }); ``` PR Close #33129
This commit is contained in:
@ -10,7 +10,7 @@ import {SchemaMetadata, ViewEncapsulation} from '../../core';
|
||||
import {ProcessProvidersFunction} from '../../di/interface/provider';
|
||||
import {Type} from '../../interface/type';
|
||||
|
||||
import {TAttributes} from './node';
|
||||
import {TConstants} from './node';
|
||||
import {CssSelectorList} from './projection';
|
||||
import {TView} from './view';
|
||||
|
||||
@ -227,7 +227,7 @@ export interface ComponentDef<T> extends DirectiveDef<T> {
|
||||
readonly template: ComponentTemplate<T>;
|
||||
|
||||
/** Constants associated with the component's view. */
|
||||
readonly consts: TAttributes[]|null;
|
||||
readonly consts: TConstants|null;
|
||||
|
||||
/**
|
||||
* An array of `ngContent[selector]` values that were found in the template.
|
||||
|
@ -224,6 +224,13 @@ export const enum AttributeMarker {
|
||||
*/
|
||||
export type TAttributes = (string | AttributeMarker | CssSelector)[];
|
||||
|
||||
/**
|
||||
* Constants that are associated with a view. Includes:
|
||||
* - Attribute arrays.
|
||||
* - Local definition arrays.
|
||||
*/
|
||||
export type TConstants = (TAttributes | string)[];
|
||||
|
||||
/**
|
||||
* Binding data (flyweight) for a particular node that is shared between all templates
|
||||
* of a specific type.
|
||||
|
@ -15,7 +15,7 @@ import {Sanitizer} from '../../sanitization/sanitizer';
|
||||
import {LContainer} from './container';
|
||||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefList, HostBindingsFunction, PipeDef, PipeDefList, ViewQueriesFunction} from './definition';
|
||||
import {I18nUpdateOpCodes, TI18n} from './i18n';
|
||||
import {TAttributes, TElementNode, TNode, TViewNode} from './node';
|
||||
import {TAttributes, TConstants, TElementNode, TNode, TViewNode} from './node';
|
||||
import {PlayerHandler} from './player';
|
||||
import {LQueries, TQueries} from './query';
|
||||
import {RElement, Renderer3, RendererFactory3} from './renderer';
|
||||
@ -555,10 +555,10 @@ export interface TView {
|
||||
schemas: SchemaMetadata[]|null;
|
||||
|
||||
/**
|
||||
* Array of attributes for all of the elements in the view. Used
|
||||
* for directive matching and attribute bindings.
|
||||
* Array of constants for the view. Includes attribute arrays, local definition arrays etc.
|
||||
* Used for directive matching, attribute bindings, local definitions and more.
|
||||
*/
|
||||
consts: TAttributes[]|null;
|
||||
consts: TConstants|null;
|
||||
}
|
||||
|
||||
export const enum RootContextFlags {Empty = 0b00, DetectChanges = 0b01, FlushPlayers = 0b10}
|
||||
|
Reference in New Issue
Block a user