Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(TS): Remove redundant instructions from tile hash (#3898)
Optimises the code in the tile hash function. During a render this function is called billions of times so this small improvement adds up, in some test scenes it reduces total render time by an average of about 2%. See https://godbolt.org/z/jMzz4PTce for the exact details. A summary would be: - Reduced instruction count from 75 to 61, this is due to the redundant add and shift operations that can be implicitely handled by taking advantage of the member layout in the class. - Halves the number of memory fetch instructions because all accesses are now 64-bit. - Removes branching instructions and extra memory indirection inside `ustring::hash()`. There is a slight change in behaviour, which is that the hash is now computed from the `m_file` pointer rather than from `m_file->filename().hash()`, so runtime reproducibility is lost. However the performance gain seems worth it. Signed-off-by: Curtis Black <[email protected]> Signed-off-by: Larry Gritz <[email protected]> Co-authored-by: Larry Gritz <[email protected]>
- Loading branch information