ElliotB256 / bevy_bench

Tests to see what bevy compiles to
1 stars 2 forks source link

Specs faster than Bevy for numerical simulation? #2

Open ElliotB256 opened 3 years ago

ElliotB256 commented 3 years ago

I'm using the two examples listed in this repo. Stats are for 1a6b9fd52.

The minimal example consists of a velocity-verlet integration of non-interacting particles in a harmonic trap. It consists of three systems: (i) integrate position, (ii) update force, (iii) integrate velocity. The benchmark integrates the following particle numbers for N steps:

pub const PARTICLE_NUMBER : i32 = 100_000;
pub const STEP_NUMBER : i32 = 1_000;

I'm performing my profiling on a workstation with an i7-8700 CPU, which has 6 cores and 12 threads. The profiling is performed using Intel VTune, Microarchitecture Exploration runs.

Results

My tests show bevy currently underperforms specs by at least an order of magnitude.

Total time

bevy: 7.417s

specs: 0.576s

CPU Load

bevy: image

specs: image

Core Utilisation

bevy: image

specs: image

Summary

bevy: image

specs: image

Disclaimer

I might well be an idiot. It's my first time using bevy, there could be something very obviously incorrect with this. I'd still be grateful to hear that :)

ElliotB256 commented 3 years ago

Discussions still ongoing.

In the meantime, added some examples to compare against legion, using 39a2723e.

Total Time

legion: 1.5s

CPU Load

image

Core Utilisation

image

Summary

image

ElliotB256 commented 3 years ago

It was foolish of me to not separate the entity creation time from the loop run time, so I'll add that for each below:

ECS create entities run loop
bevy 0.65 6.78
specs 0.03 0.54
legion 0.82 0.70

TheRawMeatball took a look and made some changes, I have not yet added those bench numbers

ElliotB256 commented 3 years ago

Updates to bevy example, now running on 9d56a6f3de5e.

Total time

bevy: 1.12

Note: Graphs below use a longer sim of 5xN steps.

CPU Load

image

Core Utilisation

image

Summary

image

ElliotB256 commented 3 years ago

Including new results:

ECS create entities run loop
bevy 0.01 1.11
specs 0.03 0.54
legion 0.82 0.70
minghuaw commented 2 years ago

Since bevy 0.6 was just released, I have run the benchmark with bevy updated to 0.6 and have everything else kept the same. Unfortunately, on my machine (i7-7700hq, 16g, Ubuntu 21.10), I did not see a significant improvement for this particular benchmark.