Skip to content

Conversation

@ggiver
Copy link

@ggiver ggiver commented Oct 30, 2024

Currently, pseudoRandom calculation uses the mod operator, which turns into fmod in the end. On non-x86 platforms, there's no hardware accelerated fmod operation, which leads to a high CPU loading and bottleneck under the software fmod calculations.
Since the divisor RANDOM_RANGE is a power of 2, it can be replaced by bitwise operation, which can improve the performance a lot on non-x86 platforms and make the workload and performance more aligned among all platforms. It can also slightly improve the performance on x86 platforms.

Currently, pseudoRandom calculation uses the mod operator, which turns
into fmod in the end. On non-x86 platforms, there's no hardware
accelerated fmod operation, which leads to a high CPU loading and
bottleneck under the software fmod calculations.
Since the divisor RANDOM_RANGE is a power of 2, it can be replaced by
bitwise operation, which can improve the performance a lot on non-x86
platforms and make the workload and performance more aligned among
all platforms. It can also slightly improve the performance on x86
platforms.
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