Closed FurryAcetylCoA closed 1 year ago
Inspired by your goal, I change the randomization code to improve the performance by 100X. The key idea is that it is not necessary to randomize each memory entry with different values. See 4fbe3ab3ba70a2cc6af0e2698a4041e89ac4dfc0.
Thank you for your contribution!
The advantage of using
getrandom
is that it allows bulk filling ofpmem
, as opposed to the byte-by-byte filling required byrand
.This change has led to a tiny optimization. Reducing the runtime about 200 milliseconds.
However, a side effect of this change is that when TARGET_AM is set. init_mem will no longer fill
pmem
with exact same random bytes every time. Given thatgetrandom
is not affect bysrand
. (I am not sure if it matters.)I can add a
#ifdef CONFIG_TARGET_AM
if necessary.