Skip to content

Commit

Permalink
Minor optimization
Browse files Browse the repository at this point in the history
Boosts GDC perf from 95 MiB/s to 152 MiB/s, so a ~62% increase. No change in DMD. LDC gained a very few MiB/s
  • Loading branch information
dd86k committed Jul 1, 2022
1 parent d50ba66 commit 70fec41
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/sha3d.d
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ private:
version (BigEndian) swap;
}

pragma(inline, true)
void THETA1(size_t i)
{
bc[i] = state64[i] ^ state64[i + 5] ^ state64[i + 10] ^ state64[i + 15] ^ state64[i + 20];
}

pragma(inline, true)
void THETA2(size_t i)
{
t = bc[(i + 4) % 5] ^ rol(bc[(i + 1) % 5], 1);
Expand All @@ -203,6 +205,7 @@ private:
state64[20 + i] ^= t;
}

pragma(inline, true)
void RHO(size_t i)
{
size_t j = K_PI[i];
Expand All @@ -211,6 +214,7 @@ private:
t = bc[0];
}

pragma(inline, true)
void CHI(size_t j)
{
bc[0] = state64[j];
Expand Down

0 comments on commit 70fec41

Please sign in to comment.