Skip to content

Commit 6c05aa0

Browse files
[Backport maintenance/v3.x] Fix hasher performance degredation caused by rust upgrade (#427)
Fix hasher performance degredation caused by rust upgrade (#426) (cherry picked from commit f544553) Co-authored-by: Rory Harris <[email protected]>
1 parent 61bad38 commit 6c05aa0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sha256-hasher/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ pub struct Hasher {
1212

1313
#[cfg(all(feature = "sha2", not(target_os = "solana")))]
1414
impl Hasher {
15+
#[inline(always)]
1516
pub fn hash(&mut self, val: &[u8]) {
1617
self.hasher.update(val);
1718
}
19+
20+
#[inline(always)]
1821
pub fn hashv(&mut self, vals: &[&[u8]]) {
1922
for val in vals {
2023
self.hash(val);
2124
}
2225
}
26+
27+
#[inline(always)]
2328
pub fn result(self) -> Hash {
2429
let bytes: [u8; solana_hash::HASH_BYTES] = self.hasher.finalize().into();
2530
bytes.into()

0 commit comments

Comments
 (0)