Fix benchmarks and profile overrides.

This was necessary because Cargo recently deprecated the "overrides"
keyword in favor of "package", and Criterion changed its interface.

This commit also now lists more configurable keys, so if they aren't set
to their defaults the user will be able to find them.  This includes the
roll key, which wasn't listed earlier and is different on Windows and
Mac.  It does *not* include the respawn key because that key is already
shown when you die.
This commit is contained in:
Joshua Yanovski 2020-01-20 13:38:58 +01:00
parent 96e0cad281
commit 898b5c6593
4 changed files with 101 additions and 70 deletions

View File

@ -107,8 +107,6 @@ coverage:
tags:
- veloren-docker
script:
- sed -i '/cargo-features/d' Cargo.toml
- sed -i '/profile.dev.overrides/,+1d' Cargo.toml
- cargo tarpaulin -v
allow_failure: true

View File

@ -22,21 +22,21 @@ codegen-units = 8
lto = false
incremental = true
# All dependencies (but not this crate itself)
[profile.dev.overrides."*"]
[profile.dev.package."*"]
opt-level = 3
[profile.dev.overrides."veloren-common"]
[profile.dev.package."veloren-common"]
opt-level = 2
[profile.dev.overrides."veloren-client"]
[profile.dev.package."veloren-client"]
opt-level = 2
[profile.dev.overrides."veloren-chat-cli"]
[profile.dev.package."veloren-chat-cli"]
opt-level = 2
[profile.dev.overrides."veloren-server"]
[profile.dev.package."veloren-server"]
opt-level = 2
[profile.dev.overrides."veloren-server-cli"]
[profile.dev.package."veloren-server-cli"]
opt-level = 2
[profile.dev.overrides."veloren-voxygen"]
[profile.dev.package."veloren-voxygen"]
opt-level = 2
[profile.dev.overrides."veloren-world"]
[profile.dev.package."veloren-world"]
opt-level = 2
# this profile is used by developers if dev doesn't has enough debug information, the name must != debug, as debug is used by dev because....

View File

@ -2,7 +2,7 @@ use common::terrain::Block;
use common::terrain::TerrainGrid;
use common::vol::SampleVol;
use common::vol::Vox;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{black_box, criterion_group, criterion_main, Benchmark, Criterion};
use std::sync::Arc;
use vek::*;
use veloren_voxygen::mesh::Meshable;
@ -12,8 +12,6 @@ const CENTER: Vec2<i32> = Vec2 { x: 512, y: 512 };
const GEN_SIZE: i32 = 4;
pub fn criterion_benchmark(c: &mut Criterion) {
// Lower sample size to save time
c = c.sample_size(15);
// Generate chunks here to test
let mut terrain = TerrainGrid::new().unwrap();
let world = World::generate(42);
@ -57,7 +55,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
// Test speed of cloning voxel sample into a flat array
let (volume, range) = sample(Vec2::new(1, 1));
c.bench_function("copying 1,1 into flat array", |b| {
c.bench(
"meshing",
Benchmark::new("copying 1,1 into flat array", move |b| {
b.iter(|| {
let mut flat = vec![Block::empty(); range.size().product() as usize];
let mut i = 0;
@ -112,14 +112,22 @@ pub fn criterion_benchmark(c: &mut Criterion) {
}*/
black_box(flat);
});
});
})
// Lower sample size to save time
.sample_size(15),
);
for x in 1..GEN_SIZE - 1 {
for y in 1..GEN_SIZE - 1 {
let (volume, range) = sample(Vec2::new(x, y));
c.bench_function(&format!("Terrain mesh {}, {}", x, y), |b| {
c.bench(
"meshing",
Benchmark::new(&format!("Terrain mesh {}, {}", x, y), move |b| {
b.iter(|| volume.generate_mesh(black_box(range)))
});
})
// Lower sample size to save time
.sample_size(15),
);
}
}
}

View File

@ -1231,6 +1231,12 @@ impl<'a> Widget for SettingsWindow<'a> {
\n\
Dodge\n\
\n\
Roll\n\
\n\
Climb\n\
\n\
Climb down\n\
\n\
Auto Walk\n\
\n\
Sheathe/Draw Weapons\n\
@ -1239,6 +1245,10 @@ impl<'a> Widget for SettingsWindow<'a> {
\n\
Sit\n\
\n\
Mount\n\
\n\
Interact\n\
\n\
\n\
Basic Attack\n\
Secondary Attack/Block/Aim\n\
@ -1318,6 +1328,16 @@ impl<'a> Widget for SettingsWindow<'a> {
\n\
{}\n\
\n\
{}\n\
\n\
{}\n\
\n\
{}\n\
\n\
{}\n\
\n\
{}\n\
\n\
\n\
{}\n\
{}\n\
@ -1369,10 +1389,15 @@ impl<'a> Widget for SettingsWindow<'a> {
controls.jump,
controls.glide,
"??", // Dodge
controls.roll,
controls.climb,
controls.climb_down,
"??", // Auto Walk
controls.toggle_wield,
"??", // Put on/Remove Helmet
controls.sit,
controls.mount,
controls.interact,
controls.primary,
controls.secondary,
"1", // Skillbar Slot 1