Skip to content

Conversation

fintelia
Copy link
Contributor

@fintelia fintelia commented Aug 19, 2024

Forcing these methods to be inlined gives a ~1% performance improvement

fn lookup(&self, index: usize) -> Result<[u8; 4], DecodingError> {
match self.color_cache.get(index) {
Some(&value) => Ok(value),
None => Err(DecodingError::BitStreamError),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch should actually be unreachable because only valid indexes can be represented in the bitstream, so I've converted it to a panic

@fintelia fintelia merged commit bdef041 into image-rs:main Aug 19, 2024
@fintelia fintelia deleted the faster-color-cache branch August 19, 2024 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant