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
|
||||
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode
|
||||
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T
|
||||
constantCache: Map<TemplateChildNode, ConstantTypes>
|
||||
constantCache: WeakMap<TemplateChildNode, ConstantTypes>
|
||||
|
||||
// 2.x Compat only
|
||||
filters?: Set<string>
|
||||
|
@ -181,7 +181,7 @@ export function createTransformContext(
|
|||
directives: new Set(),
|
||||
hoists: [],
|
||||
imports: [],
|
||||
constantCache: new Map(),
|
||||
constantCache: new WeakMap(),
|
||||
temps: 0,
|
||||
cached: 0,
|
||||
identifiers: Object.create(null),
|
||||
|
|
|
@ -227,7 +227,7 @@ export function createAppAPI<HostElement>(
|
|||
})
|
||||
}
|
||||
|
||||
const installedPlugins = new Set()
|
||||
const installedPlugins = new WeakSet()
|
||||
|
||||
let isMounted = false
|
||||
|
||||
|
|
|
@ -18,7 +18,10 @@ type LegacyAsyncComponent = (
|
|||
reject?: (reason?: any) => void
|
||||
) => LegacyAsyncReturnValue | undefined
|
||||
|
||||
const normalizedAsyncComponentMap = new Map<LegacyAsyncComponent, Component>()
|
||||
const normalizedAsyncComponentMap = new WeakMap<
|
||||
LegacyAsyncComponent,
|
||||
Component
|
||||
>()
|
||||
|
||||
export function convertLegacyAsyncComponent(comp: LegacyAsyncComponent) {
|
||||
if (normalizedAsyncComponentMap.has(comp)) {
|
||||
|
|
|
@ -8,11 +8,10 @@ import { InternalSlots } from '../componentSlots'
|
|||
import { getCompatListeners } from './instanceListeners'
|
||||
import { compatH } from './renderFn'
|
||||
|
||||
const normalizedFunctionalComponentMap = new Map<
|
||||
const normalizedFunctionalComponentMap = new WeakMap<
|
||||
ComponentOptions,
|
||||
FunctionalComponent
|
||||
>()
|
||||
|
||||
export const legacySlotProxyHandlers: ProxyHandler<InternalSlots> = {
|
||||
get(target, key: string) {
|
||||
const slot = target[key]
|
||||
|
|
Loading…
Reference in New Issue