The previous behavior invokes the definePropery proxy trap on the
instance proxy and has massive overhead. This change improves Vue
ops/sec by 40% in https://github.com/eknkc/ssr-benchmark
// 0. create render proxy property access cache
instance.accessCache = Object.create(null)
// 1. create public instance / render proxy
- // also mark it raw so it's never observed
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers))
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers)
if (__DEV__) {
exposePropsOnRenderContext(instance)
}
isString,
} from '@vue/shared'
import {
+ ReactiveFlags,
type ShallowUnwrapRef,
TrackOpTypes,
type UnwrapNestedRefs,
export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
get({ _: instance }: ComponentRenderContext, key: string) {
+ if (key === ReactiveFlags.SKIP) {
+ return true
+ }
+
const { ctx, setupState, data, props, accessCache, type, appContext } =
instance