On Mon, Dec 14, 2009 at 07:44:31AM -0500, Ted Unangst wrote: > On Mon, Dec 14, 2009 at 3:58 AM, Otto Moerbeek <o...@drijf.net> wrote: > >> apart from the random page addresses obtained form mmap(2) malloc(3) > >> itself also randomizes cache en chunk operations. It uses a nibble of > >> randomness per call, so optimize that to not waste half the random > >> bits. > >> > >> Please test, should be a bit faster. > > I don't really like this. It looks complicated (hard to judge). arc4 > is fast enough I don't think we need to worry about conserving bits, > and I'd be surprised if it actually were faster considering how much > work you're doing per nibble compared to the work to just run arc4. > However fast it may be, I feel much safer with the current code.
Every call to arc4random_buf() causes a getpid() call, which is a syscall with all the overhead. This saves half of those. -Otto