Skip to content

have you noticed its much faster to clear and rebuild the tree every tick? #92

@manidkdontmatter

Description

@manidkdontmatter

kinda weird no? it's 2.5x faster. example:

// 44 fps
for (let i = 0; i < 2000; i++) {
	var o = dynamicObjects[Math.floor(Math.random() * dynamicObjects.length)]
	o.move(64 * dt, false)
}
system.update()
system.separate()

// 113 fps
system.clear() // if i could only clear and rebuild the dynamic branch of the rtree i bet this would be even faster. right now im having to clear the whole thing which means i have to load statics back in (see below) and dynamics instead of only dynamics
for (let i = 0; i < 2000; i++) {
	var o = dynamicObjects[Math.floor(Math.random() * dynamicObjects.length)]
	o.move(64 * dt, false)
}
system.load(staticObjects)
system.load(dynamicObjects)
system.separate()

would this influence your design decisions at all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredfix is available, awaiting response from authorenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions