mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
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:
parent
96e0cad281
commit
898b5c6593
@ -107,8 +107,6 @@ coverage:
|
|||||||
tags:
|
tags:
|
||||||
- veloren-docker
|
- veloren-docker
|
||||||
script:
|
script:
|
||||||
- sed -i '/cargo-features/d' Cargo.toml
|
|
||||||
- sed -i '/profile.dev.overrides/,+1d' Cargo.toml
|
|
||||||
- cargo tarpaulin -v
|
- cargo tarpaulin -v
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
|
16
Cargo.toml
16
Cargo.toml
@ -22,21 +22,21 @@ codegen-units = 8
|
|||||||
lto = false
|
lto = false
|
||||||
incremental = true
|
incremental = true
|
||||||
# All dependencies (but not this crate itself)
|
# All dependencies (but not this crate itself)
|
||||||
[profile.dev.overrides."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
[profile.dev.overrides."veloren-common"]
|
[profile.dev.package."veloren-common"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-client"]
|
[profile.dev.package."veloren-client"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-chat-cli"]
|
[profile.dev.package."veloren-chat-cli"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-server"]
|
[profile.dev.package."veloren-server"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-server-cli"]
|
[profile.dev.package."veloren-server-cli"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-voxygen"]
|
[profile.dev.package."veloren-voxygen"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
[profile.dev.overrides."veloren-world"]
|
[profile.dev.package."veloren-world"]
|
||||||
opt-level = 2
|
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....
|
# 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....
|
||||||
|
@ -2,7 +2,7 @@ use common::terrain::Block;
|
|||||||
use common::terrain::TerrainGrid;
|
use common::terrain::TerrainGrid;
|
||||||
use common::vol::SampleVol;
|
use common::vol::SampleVol;
|
||||||
use common::vol::Vox;
|
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 std::sync::Arc;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use veloren_voxygen::mesh::Meshable;
|
use veloren_voxygen::mesh::Meshable;
|
||||||
@ -12,8 +12,6 @@ const CENTER: Vec2<i32> = Vec2 { x: 512, y: 512 };
|
|||||||
const GEN_SIZE: i32 = 4;
|
const GEN_SIZE: i32 = 4;
|
||||||
|
|
||||||
pub fn criterion_benchmark(c: &mut Criterion) {
|
pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
// Lower sample size to save time
|
|
||||||
c = c.sample_size(15);
|
|
||||||
// Generate chunks here to test
|
// Generate chunks here to test
|
||||||
let mut terrain = TerrainGrid::new().unwrap();
|
let mut terrain = TerrainGrid::new().unwrap();
|
||||||
let world = World::generate(42);
|
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
|
// Test speed of cloning voxel sample into a flat array
|
||||||
let (volume, range) = sample(Vec2::new(1, 1));
|
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(|| {
|
b.iter(|| {
|
||||||
let mut flat = vec![Block::empty(); range.size().product() as usize];
|
let mut flat = vec![Block::empty(); range.size().product() as usize];
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
@ -112,14 +112,22 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
}*/
|
}*/
|
||||||
black_box(flat);
|
black_box(flat);
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
// Lower sample size to save time
|
||||||
|
.sample_size(15),
|
||||||
|
);
|
||||||
|
|
||||||
for x in 1..GEN_SIZE - 1 {
|
for x in 1..GEN_SIZE - 1 {
|
||||||
for y in 1..GEN_SIZE - 1 {
|
for y in 1..GEN_SIZE - 1 {
|
||||||
let (volume, range) = sample(Vec2::new(x, y));
|
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)))
|
b.iter(|| volume.generate_mesh(black_box(range)))
|
||||||
});
|
})
|
||||||
|
// Lower sample size to save time
|
||||||
|
.sample_size(15),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1231,6 +1231,12 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
\n\
|
\n\
|
||||||
Dodge\n\
|
Dodge\n\
|
||||||
\n\
|
\n\
|
||||||
|
Roll\n\
|
||||||
|
\n\
|
||||||
|
Climb\n\
|
||||||
|
\n\
|
||||||
|
Climb down\n\
|
||||||
|
\n\
|
||||||
Auto Walk\n\
|
Auto Walk\n\
|
||||||
\n\
|
\n\
|
||||||
Sheathe/Draw Weapons\n\
|
Sheathe/Draw Weapons\n\
|
||||||
@ -1239,6 +1245,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
\n\
|
\n\
|
||||||
Sit\n\
|
Sit\n\
|
||||||
\n\
|
\n\
|
||||||
|
Mount\n\
|
||||||
|
\n\
|
||||||
|
Interact\n\
|
||||||
|
\n\
|
||||||
\n\
|
\n\
|
||||||
Basic Attack\n\
|
Basic Attack\n\
|
||||||
Secondary Attack/Block/Aim\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\
|
||||||
\n\
|
\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
@ -1369,10 +1389,15 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
controls.jump,
|
controls.jump,
|
||||||
controls.glide,
|
controls.glide,
|
||||||
"??", // Dodge
|
"??", // Dodge
|
||||||
|
controls.roll,
|
||||||
|
controls.climb,
|
||||||
|
controls.climb_down,
|
||||||
"??", // Auto Walk
|
"??", // Auto Walk
|
||||||
controls.toggle_wield,
|
controls.toggle_wield,
|
||||||
"??", // Put on/Remove Helmet
|
"??", // Put on/Remove Helmet
|
||||||
controls.sit,
|
controls.sit,
|
||||||
|
controls.mount,
|
||||||
|
controls.interact,
|
||||||
controls.primary,
|
controls.primary,
|
||||||
controls.secondary,
|
controls.secondary,
|
||||||
"1", // Skillbar Slot 1
|
"1", // Skillbar Slot 1
|
||||||
|
Loading…
Reference in New Issue
Block a user