A simple actor-based simulation of tag, implemented in rust.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
  2. use gntag::get_world;
  3. fn world(c: &mut Criterion) {
  4. let mut group = c.benchmark_group("world");
  5. let width: isize = 1000;
  6. for spacing in (50..=100).step_by(25) {
  7. group.throughput(Throughput::Elements((width / spacing).pow(2) as u64));
  8. group.bench_with_input(
  9. BenchmarkId::new("validating", spacing),
  10. &spacing,
  11. |b, &spacing| {
  12. let mut world = get_world(width, width, spacing as usize, true);
  13. b.iter(|| world.do_step());
  14. },
  15. );
  16. group.bench_with_input(
  17. BenchmarkId::new("non-validating", spacing),
  18. &spacing,
  19. |b, &spacing| {
  20. let mut world = get_world(width, width, spacing as usize, false);
  21. b.iter(|| world.do_step());
  22. },
  23. );
  24. }
  25. group.finish();
  26. }
  27. criterion_group!(benches, world);
  28. criterion_main!(benches);
  29. // 5000/1000 -> 9,993
  30. // 5/01 -> 23,252
  31. // 50/10 -> 14,000
  32. // 100/20 -> 14,000
  33. // 100/10 -> 96,000
  34. // 100/05 -> 917,767
  35. // 200/10 -> 916,172
  36. // 1000/10 -> 443,482,526