Hi,

I have applied most advice I got here and pushed a new version of crypto.aes:
  https://github.com/kerneis/factor/commits/aes
(beware if you pulled the previous one, the branch has been rebased).

I have an issue when I USE: the vocabulary: it fails because I use `>byte-array`
in `CONSTANT: inv-sbox`, but `>byte-array` has not been compiled yet.  Reloading
the vocabulary works, though, so I'm a bit confused; it looks like some kind of
race-condition.

On Mon, May 27, 2013 at 09:51:04AM -0700, John Benediktsson wrote:
> Nice!  Have you had a chance to look at performance?

Since premature optimization is the root of all evil, I benchmarked and profiled
each of my commits (`run-bench` and `[ aes-128-encrypt ] profile-bench`).

You can find the results below, running on an Intel Core2 Duo L9400 @ 1.86GHz.
Most recent commits are at the top. Results are the number of random blocks
encrypted and decrypted by second (higher is better), with a pre-expanded,
constant random key.

An AES block is 16 bytes, so the current implementation encrypts at ~124kB/s,
and decrypts at ~84kB/s.  Note that decryption is necessarily slower than
encryption because of the way gf-mult is implemented: `a b gf-mult` is
proportionnal to the log(b), and decryption involves larger b than encryption.


commit                                         enc  dec (block/s)
--------------------------------------------------------
* type explicitly elementary operations        7752 5246
    Overall speedup, wrt. "use constants":
    × 1.7.

* specialized flip for blocks                  5510 4312
    This decreases performance slightly, but
    is necessary for further static typing
    which improves it a lot (see next commit).

* coerce nxtimes result to byte-array          6470 4886
* type nxtimes explicitly                      5001 3470
* type gf-mult explicitly                      4801 3220

* use byte-arrays for words                    4330 2902
    Naive use of byte-arrays decreases
    performance.

* avoid flip in unit tests                     4437 2855
* remove unused T- and D-tables                4445 2855
    Cleanup commits, no impact on
    performance.

* use constants                                4424 2939
    Decryption is greatly improved because
    inv-sbox used to be recomputed on each
    use (speedup: × 8.2).

* better word names and stack effects          4470  370
    This drop of encryption performance is
    strange, because there is no change in
    the code.  Probably not significant.

* add benchmark                                4500  360
* feature-complete inefficient implementation  ---- ----

Best regards,
-- 
Gabriel

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to