Skip to content

Commit

Permalink
fix benches
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCrumpLeys committed Jun 20, 2024
1 parent 65a35f7 commit 733be92
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions benches/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use valence::block::{BlockKind, BlockState, PropName, PropValue};
use valence::ItemKind;

#[divan::bench]
pub fn from_kind(bencher: Bencher) {
pub(crate) fn from_kind(bencher: Bencher) {
bencher.bench(|| {
for kind in black_box(BlockKind::ALL) {
black_box(BlockState::from_kind(kind));
}
});
}
#[divan::bench]
pub fn to_kind(bencher: Bencher) {
pub(crate) fn to_kind(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -22,7 +22,7 @@ pub fn to_kind(bencher: Bencher) {
});
}
#[divan::bench]
pub fn get_prop(bencher: Bencher) {
pub(crate) fn get_prop(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -31,7 +31,7 @@ pub fn get_prop(bencher: Bencher) {
});
}
#[divan::bench]
pub fn set_prop(bencher: Bencher) {
pub(crate) fn set_prop(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -40,7 +40,7 @@ pub fn set_prop(bencher: Bencher) {
});
}
#[divan::bench]
pub fn is_liquid(bencher: Bencher) {
pub(crate) fn is_liquid(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -49,7 +49,7 @@ pub fn is_liquid(bencher: Bencher) {
});
}
#[divan::bench]
pub fn is_opaque(bencher: Bencher) {
pub(crate) fn is_opaque(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -58,7 +58,7 @@ pub fn is_opaque(bencher: Bencher) {
});
}
#[divan::bench]
pub fn is_replaceable(bencher: Bencher) {
pub(crate) fn is_replaceable(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -67,7 +67,7 @@ pub fn is_replaceable(bencher: Bencher) {
});
}
#[divan::bench]
pub fn luminance(bencher: Bencher) {
pub(crate) fn luminance(bencher: Bencher) {
let states = BlockKind::ALL.map(BlockKind::to_state);
bencher.bench(|| {
for state in black_box(states) {
Expand All @@ -76,15 +76,15 @@ pub fn luminance(bencher: Bencher) {
});
}
#[divan::bench]
pub fn to_item_kind(bencher: Bencher) {
pub(crate) fn to_item_kind(bencher: Bencher) {
bencher.bench(|| {
for kind in black_box(BlockKind::ALL) {
black_box(kind.to_item_kind());
}
});
}
#[divan::bench]
pub fn from_item_kind(bencher: Bencher) {
pub(crate) fn from_item_kind(bencher: Bencher) {
bencher.bench(|| {
for kind in black_box(ItemKind::ALL) {
black_box(BlockKind::from_item_kind(kind));
Expand Down
4 changes: 2 additions & 2 deletions benches/decode_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use divan::Bencher;
use valence::protocol::{Decode, Encode};

#[divan::bench]
pub fn decode_small_array(bencher: Bencher) {
pub(crate) fn decode_small_array(bencher: Bencher) {
let floats = [123.0, 456.0, 789.0];
let mut buf = [0_u8; 24];

Expand All @@ -17,7 +17,7 @@ pub fn decode_small_array(bencher: Bencher) {
}

#[divan::bench]
pub fn decode_large_array(bencher: Bencher) {
pub(crate) fn decode_large_array(bencher: Bencher) {
let bytes = [42; 4096];

bencher.bench(|| {
Expand Down
2 changes: 1 addition & 1 deletion benches/idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use valence::prelude::*;
/// Benches the performance of a single server tick while nothing much is
/// happening.
#[divan::bench]
pub fn idle_update(bencher: Bencher) {
pub(crate) fn idle_update(bencher: Bencher) {
let mut app = App::new();

app.add_plugins(DefaultPlugins);
Expand Down
2 changes: 1 addition & 1 deletion benches/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use valence::text::IntoText;
use valence_server::protocol::Velocity;
use valence_server::CompressionThreshold;

pub fn setup<'a>() -> (
pub(crate) fn setup<'a>() -> (
PacketEncoder,
ChunkDataS2c<'a>,
PlayerListHeaderS2c<'a>,
Expand Down

0 comments on commit 733be92

Please sign in to comment.