aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2026-03-06 18:37:50 -1245
committermat <git@matdoes.dev>2026-03-06 22:38:27 -0845
commit75a7ec5f2989073a3534f377bfeb0d23de844593 (patch)
tree00f355dd5ba23356ced696c4f5d1a6a2ce9c2d16
parent8dc511bb1b77da67d5428e8bafeab92ad3bfabf4 (diff)
downloadazalea-drasl-75a7ec5f2989073a3534f377bfeb0d23de844593.tar.xz
speed up PalettedContainer::get_at_index by inlining things
-rw-r--r--azalea-world/src/bit_storage.rs1
-rw-r--r--azalea-world/src/palette/container.rs1
-rw-r--r--azalea-world/src/palette/mod.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/azalea-world/src/bit_storage.rs b/azalea-world/src/bit_storage.rs
index cefc0aeb..4e858413 100644
--- a/azalea-world/src/bit_storage.rs
+++ b/azalea-world/src/bit_storage.rs
@@ -167,6 +167,7 @@ impl BitStorage {
///
/// This function will panic if the given index is greater than or equal to
/// the size of this storage.
+ #[inline]
pub fn get(&self, index: usize) -> u64 {
assert!(
index < self.size,
diff --git a/azalea-world/src/palette/container.rs b/azalea-world/src/palette/container.rs
index 43262a3d..2cef4dd6 100644
--- a/azalea-world/src/palette/container.rs
+++ b/azalea-world/src/palette/container.rs
@@ -177,6 +177,7 @@ impl<S: PalletedContainerKind> PalettedContainer<S> {
/// This function panics if the index is greater than or equal to the number
/// of things in the storage. For example, for block states, it must be less
/// than 4096.
+ #[inline]
pub fn get_at_index(&self, index: usize) -> S {
// first get the palette id
let paletted_value = self.storage.get(index);
diff --git a/azalea-world/src/palette/mod.rs b/azalea-world/src/palette/mod.rs
index 067c68c4..4fa81adc 100644
--- a/azalea-world/src/palette/mod.rs
+++ b/azalea-world/src/palette/mod.rs
@@ -24,6 +24,7 @@ pub enum Palette<S: PalletedContainerKind> {
}
impl<S: PalletedContainerKind> Palette<S> {
+ #[inline]
pub fn value_for(&self, id: usize) -> S {
match self {
Palette::SingleValue(v) => *v,