equal
deleted
inserted
replaced
31 }); |
31 }); |
32 } |
32 } |
33 |
33 |
34 pub fn component_run(c: &mut Criterion) { |
34 pub fn component_run(c: &mut Criterion) { |
35 let mut manager = GearDataManager::new(); |
35 let mut manager = GearDataManager::new(); |
36 manager.register::<Pv>(); |
36 |
|
37 manager.register::<P>(); |
|
38 manager.register::<V>(); |
|
39 |
37 for i in 1..=SIZE { |
40 for i in 1..=SIZE { |
38 let gear_id = GearId::new(i as u16).unwrap(); |
41 let gear_id = GearId::new(i as u16).unwrap(); |
39 manager.add(gear_id, &Pv::default()); |
42 manager.add(gear_id, &P::default()); |
|
43 manager.add(gear_id, &V::default()); |
40 } |
44 } |
41 |
45 |
42 c.bench_function("component run", |b| { |
46 c.bench_function("component run", |b| { |
43 b.iter(|| { |
47 b.iter(|| { |
44 manager |
48 manager |
45 .iter() |
49 .iter() |
46 .run(|(item,): (&mut Pv,)| item.velocity += black_box(item.position)); |
50 .run(|(p, v): (&mut P, &mut V)| v.velocity += black_box(p.position)); |
47 }) |
51 }) |
48 }); |
52 }); |
49 } |
53 } |
50 |
54 |
51 pub fn component_add_remove(c: &mut Criterion) { |
55 pub fn component_add_remove(c: &mut Criterion) { |