mirror of https://github.com/vuejs/core.git
perf: replace Map/Set with WeakMap/WeakSet (#8549)
This commit is contained in:
parent
4162311efd
commit
712f96d6ac
|
@ -117,7 +117,7 @@ export interface TransformContext
|
||||||
removeIdentifiers(exp: ExpressionNode | string): void
|
removeIdentifiers(exp: ExpressionNode | string): void
|
||||||
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode
|
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode
|
||||||
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T
|
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T
|
||||||
constantCache: Map<TemplateChildNode, ConstantTypes>
|
constantCache: WeakMap<TemplateChildNode, ConstantTypes>
|
||||||
|
|
||||||
// 2.x Compat only
|
// 2.x Compat only
|
||||||
filters?: Set<string>
|
filters?: Set<string>
|
||||||
|
@ -181,7 +181,7 @@ export function createTransformContext(
|
||||||
directives: new Set(),
|
directives: new Set(),
|
||||||
hoists: [],
|
hoists: [],
|
||||||
imports: [],
|
imports: [],
|
||||||
constantCache: new Map(),
|
constantCache: new WeakMap(),
|
||||||
temps: 0,
|
temps: 0,
|
||||||
cached: 0,
|
cached: 0,
|
||||||
identifiers: Object.create(null),
|
identifiers: Object.create(null),
|
||||||
|
|
|
@ -227,7 +227,7 @@ export function createAppAPI<HostElement>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const installedPlugins = new Set()
|
const installedPlugins = new WeakSet()
|
||||||
|
|
||||||
let isMounted = false
|
let isMounted = false
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@ type LegacyAsyncComponent = (
|
||||||
reject?: (reason?: any) => void
|
reject?: (reason?: any) => void
|
||||||
) => LegacyAsyncReturnValue | undefined
|
) => LegacyAsyncReturnValue | undefined
|
||||||
|
|
||||||
const normalizedAsyncComponentMap = new Map<LegacyAsyncComponent, Component>()
|
const normalizedAsyncComponentMap = new WeakMap<
|
||||||
|
LegacyAsyncComponent,
|
||||||
|
Component
|
||||||
|
>()
|
||||||
|
|
||||||
export function convertLegacyAsyncComponent(comp: LegacyAsyncComponent) {
|
export function convertLegacyAsyncComponent(comp: LegacyAsyncComponent) {
|
||||||
if (normalizedAsyncComponentMap.has(comp)) {
|
if (normalizedAsyncComponentMap.has(comp)) {
|
||||||
|
|
|
@ -8,11 +8,10 @@ import { InternalSlots } from '../componentSlots'
|
||||||
import { getCompatListeners } from './instanceListeners'
|
import { getCompatListeners } from './instanceListeners'
|
||||||
import { compatH } from './renderFn'
|
import { compatH } from './renderFn'
|
||||||
|
|
||||||
const normalizedFunctionalComponentMap = new Map<
|
const normalizedFunctionalComponentMap = new WeakMap<
|
||||||
ComponentOptions,
|
ComponentOptions,
|
||||||
FunctionalComponent
|
FunctionalComponent
|
||||||
>()
|
>()
|
||||||
|
|
||||||
export const legacySlotProxyHandlers: ProxyHandler<InternalSlots> = {
|
export const legacySlotProxyHandlers: ProxyHandler<InternalSlots> = {
|
||||||
get(target, key: string) {
|
get(target, key: string) {
|
||||||
const slot = target[key]
|
const slot = target[key]
|
||||||
|
|
Loading…
Reference in New Issue