perf(kiwi): avoid shifting import propagation queues
This commit is contained in:
parent
123a5ceddb
commit
f9034d4492
|
|
@ -178,7 +178,10 @@ function propagateScaling(ctx: OverrideContext, scaled: Set<string>): void {
|
|||
const queue = [...scaled]
|
||||
const visited = new Set<string>()
|
||||
|
||||
for (let srcId = queue.shift(); srcId !== undefined; srcId = queue.shift()) {
|
||||
let index = 0
|
||||
while (index < queue.length) {
|
||||
const srcId = queue[index]
|
||||
index++
|
||||
const source = graph.getNode(srcId)
|
||||
if (!source) continue
|
||||
const clones = clonesOf.get(srcId)
|
||||
|
|
|
|||
|
|
@ -206,7 +206,10 @@ function propagateDsdChanges(
|
|||
const queue = [...modified]
|
||||
const visited = new Set<string>()
|
||||
|
||||
for (let sourceId = queue.shift(); sourceId !== undefined; sourceId = queue.shift()) {
|
||||
let index = 0
|
||||
while (index < queue.length) {
|
||||
const sourceId = queue[index]
|
||||
index++
|
||||
const source = ctx.graph.getNode(sourceId)
|
||||
if (!source) continue
|
||||
const clones = clonesOf.get(sourceId)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ import type { SceneGraph } from '#core/scene-graph'
|
|||
function collectSubtreeIds(graph: SceneGraph, rootIds: Iterable<string>): Set<string> {
|
||||
const result = new Set<string>()
|
||||
const queue = [...rootIds]
|
||||
for (let id = queue.shift(); id !== undefined; id = queue.shift()) {
|
||||
let index = 0
|
||||
while (index < queue.length) {
|
||||
const id = queue[index]
|
||||
index++
|
||||
if (result.has(id)) continue
|
||||
result.add(id)
|
||||
const node = graph.getNode(id)
|
||||
|
|
@ -60,8 +63,10 @@ export function populateInstances(
|
|||
|
||||
const queue = [...rootIds]
|
||||
const visited = new Set<string>()
|
||||
while (queue.length > 0) {
|
||||
const nodeId = queue.shift()
|
||||
let index = 0
|
||||
while (index < queue.length) {
|
||||
const nodeId = queue[index]
|
||||
index++
|
||||
if (!nodeId || visited.has(nodeId)) continue
|
||||
visited.add(nodeId)
|
||||
ensurePopulated(nodeId)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,10 @@ export function propagateOverridesTransitively(
|
|||
|
||||
const visited = new Set<string>()
|
||||
const syncQueue = [...expandedSeeds]
|
||||
for (let sourceId = syncQueue.shift(); sourceId !== undefined; sourceId = syncQueue.shift()) {
|
||||
let index = 0
|
||||
while (index < syncQueue.length) {
|
||||
const sourceId = syncQueue[index]
|
||||
index++
|
||||
const clones = clonesOf.get(sourceId)
|
||||
if (!clones) continue
|
||||
const source = graph.getNode(sourceId)
|
||||
|
|
|
|||
Loading…
Reference in a new issue