perf: improve memory usage for static vnodes

Use the already mounted nodes as cache instead of separate caching via
template. This reduces memory usage by 30%+ in VitePress.
This commit is contained in:
Evan You
2022-01-16 20:39:55 +08:00
parent f4f0966b33
commit ed9eb62e59
3 changed files with 42 additions and 11 deletions

View File

@@ -124,7 +124,9 @@ export interface RendererOptions<
content: string,
parent: HostElement,
anchor: HostNode | null,
isSVG: boolean
isSVG: boolean,
start?: HostNode | null,
end?: HostNode | null
): [HostNode, HostNode]
}
@@ -511,7 +513,9 @@ function baseCreateRenderer(
n2.children as string,
container,
anchor,
isSVG
isSVG,
n2.el,
n2.anchor
)
}