Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantify perf difference between Cannon and Ammo #13

Open
diarmidmackenzie opened this issue Nov 3, 2022 · 4 comments
Open

Quantify perf difference between Cannon and Ammo #13

diarmidmackenzie opened this issue Nov 3, 2022 · 4 comments

Comments

@diarmidmackenzie
Copy link
Member

We have a perf test that has been used to compare Ammo vs. PhysX
https://c-frame.github.io/physx/examples/pinboard/ammo-vs-physx.html

This depends on some minor updates to aframe-physics-system to report timing data, which aren't in this fork yet.

We should:

  • Being these changes into this fork (possibly controlled by a proprerty in the main physics schema)
  • Bring this example into this repo's examples, including cannon and cannon-worker versions
  • Quantify the perf difference between Ammo and Cannon in the README section that gives advice on which driver to use.
@diarmidmackenzie
Copy link
Member Author

See PR#14

Current data on my PC is showing:

  • Cannon: ~7.5msecs
  • Ammo: ~5.2msecs
  • PhysX: ~1.6msecs

As documented in #15 , we can shave ~1.5msecs off Ammo, which would bring it to ~3.7msecs.

That would give us a position where Ammo = ~2x PhysX and Cannon = ~2x Ammo.

This is just one benchmark, tested on just one device, and we may find that different tests & different devices reveal different performance characteristics.

@kylebakerio
Copy link
Member

image

This is what I'm getting on that demo page, fwiw. It keeps fluctuating significantly, though--are the same number of balls generated per-measurement-period ?

@kylebakerio
Copy link
Member

kylebakerio commented Nov 7, 2022

I also find watching the subtle behavior difference between the two interesting.

image

You can see on the left that the physx engine is more prone to have balls get 'stuck' on this simulation, like they have more friction almost? Constantly happening on left, buildup is less and less often on the right:

image

It does feel like it's more realistic to my eye right now.

Also, though, sometimes the newly added balls 'bounce up' as well on the physX side--they seem to do this because those 'back ups' happen at the top of the board, and so the new ball is dropped on top of an existing ball that has pushback. Doesn't seem like desired behavior.

It's interesting that Cannon behaves seems to also exhibit the same behavior as PhysX, as opposed to ammo--clumps and clumps at tops causing jumps.

On my laptop, PhysX is 3x faster than Ammo, and 6.5x faster than cannon.

Anyways, I digress, I just enjoy performance testing.

@diarmidmackenzie
Copy link
Member Author

Quite likely that the different engines have different default materials, masses etc

I didn't modify anything away from the defaults, except to set restitution to 0 on cannon, as the default restitution of 0.3 was way too bouncy.

All the engines offer various ways of configuring friction etc. I expect work can be done to compare settings and get them better aligned with each other.

Some differences may be down to the engine itself, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants