Skip to content

collision-rs takes 6 seconds to create a DBVT with 16,000 entries #119

@KeyboardDanni

Description

@KeyboardDanni

Using collision crate 0.20.1

I just started integrating this crate into my game engine for accelerating collision detection, and I noticed that building the initial tree seems to be taking a very long time. I am trying to create 16,000 collidable objects, which seems to be taking about 6 seconds. I would expect 100ms, or maybe even 600ms, but 6 seconds is too long.

Building with [profile.dev] opt-level = 2. Callgrind reports that 99% of time is spent in DynamicBoundingVolumeTree::tick(), and 96% of that time is spent doing a memcpy (specifically __memcpy_avx_unaligned_erms).

You can find the source of my current attempt here: https://gitlab.com/cosmicchipsocket/keeshond/-/blob/master/keeshond_treats/src/collision.rs

Am I using the library wrong? Or is DBVT not a good match for what I want to do? And why is it doing so many copies? I don't think my CollisionLeaf struct is particularly heavy - it's an Entity (which has a usize and u64), and two Aabb<f64>s.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions