[PATCH] D35221: [scudo] PRNG makeover

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 09:09:49 PDT 2017


cryptoad added inline comments.


================
Comment at: lib/scudo/scudo_utils.h:84
+    // size of the random data left in the cache.
+    CachedBytes = next() | (1ULL << 63);
+  }
----------------
cryptoad wrote:
> alekseyshl wrote:
> > Does this trick really help with performance?
> The numbers do not differ enough to go one way or the other, but the u8 was taking up to extra 8bytes depending on architecture. It feels it should be faster, but it definitely save space.
Actually scratch that. My machine was too loaded to give correct results.
The initial version appears to be faster (with the u8):

```
kostyak at kostyak-linux:~$ clang++ -O3 rand.cc -o rand -DWITH_CACHEDBYTESAVAILABLE
kostyak at kostyak-linux:~$ ./rand                                                 
[?] duration: 4009332558ns
kostyak at kostyak-linux:~$ clang++ -O3 rand.cc -o rand
kostyak at kostyak-linux:~$ ./rand
[?] duration: 4788913046ns
```
For 1<<32 iterations of `getU8`, and quite stable over the course of multiple runs.

I am going to reintroduce it.



https://reviews.llvm.org/D35221





More information about the llvm-commits mailing list