user-pic

Peter Rabbitson

Subscribe to feed Recent Actions from Peter Rabbitson

  • Dave Jacoby commented on Seeing the SQL in DBIx::Class

    I put this aside, because the important my-query-is-slow problem wasn't urgent.

    I don't think the ->as_query() comment was there when I did so.

    Glad I waited. Thanks, Peter.

  • Dana Jacobsen commented on Alternatives to rand()

    Peter, some modules offer this (ntheory, Crypt::Random, Crypt::Urandom) but none of them do a rand() style interface to it. It would be easy enough to create. On my Macbook, bulk reads from /dev/urandom run at 12 MB/s, which would make it quite slow compared to most of these modules. It is very system dependent -- my Fedora 20 desktop runs at a similarly slow 17 MB/s while the Fedora 23 desktop at 185 MB/s. A new CentOS 7 160-core Power 8 machine runs at 5 MB/s.

    In raw speed the older /dev/urandom device is about 40x slower than standard ChaCha20. Fast PRNGs like we would expect…

  • 3ee5cf54-f022-4a71-8666-3c2b5ee231dd [openid.stackexchange.com] commented on Alternatives to rand()
    The only downside is the slow performance, which is typical of the AES-CTR algorithm.

    It shouldn't be on semi-recent hardware (which has AES support). On my not-so-recent box, openssl speed -evp chacha20 gets 1.6GB/sec with big blocks, but … -evp aes-128-ctr gets 5.1GB/sec. Even aes-256-ctr gets 3.6GB/sec.

    I'm not sure those are the exact right EVP arguments to give it to test, but the presence of dedicated AES hardware makes AES the fastest option, almost always.

  • Dana Jacobsen commented on Alternatives to rand()

    Thanks for the note. You are correct that if run on machines with AES support (which is a *lot*, and OpenSSL supports a huge number of them) and if the software supports it, then indeed it's very fast. I added a parenthetical note.

    None of the Perl modules do this. Crypt::Rijndael's AES C code is the standard reference C code. CryptX uses LibTomCrypt which is based on the original reference code. So they are not very fast (relative to other PRNGs). Fortuna also includes running SHA2, which further slows down the output. Crypt::PRNG (Fortuna) runs at 0.14 GB/s on this machine, …

  • Yuki Kimoto commented on Alternatives to rand()

    This comparison is very easy to understand.

Subscribe to feed Responses to Comments from Peter Rabbitson

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.