Repository navigation
Adding benchmark for ciphers - #333
Conversation
|
Note: This currently will only work on OpenJDK until #330 is resolved. |
|
FYI, results show we have a lot of work to do :) |
| private static final String ALGORITHM = "AES"; | ||
| private static final int KEY_SIZE = 128; | ||
|
|
||
| public enum BufferType { ARRAY, HEAP, DIRECT } |
There was a problem hiding this comment.
nit: IIRC ther eis some code that behaves differently if the source and destination are heap vs non heap. For the byte buffer, you might consider having separate source and destination HEAP_DIRECT, HEAP_HEAP, DIRECT_HEAP, and DIRECT_DIRECT cases.
There was a problem hiding this comment.
That would really blow up the benchmark matrix ... not sure it's worth it.
There was a problem hiding this comment.
If you look at the CipherSpi.engineDoFinal, you can see they have 3 disctinct cases based on if the buffer is array backed or not. I think it would be worth the extra cases, since the existing implementation treats each one differently.
There was a problem hiding this comment.
Done ... I've updated the benchmark results. Nothing too unexpected.
|
Something is funny here; the results don't line up with results from actual
usage. What version of JDK are you using?
Also, you should probably BlackHole the result. I'd explicitly set the
ALGORITHM as well. I wonder if AES/CTR/NoPadding is the same?
|
It should be noted that we're only calling the methods where there is both an input and output. Perhaps normal usage calls a different version of the methods?
Using OpenJDK 8 (our internal version)
done. Although I'm not seeing much of a difference in the results.
What's the best way to do what you're suggesting? |
carl-mastrangelo
left a comment
There was a problem hiding this comment.
No other comments from me.
Thanks for looking into this.
Supporting perf work for google#317
|
@flooey the AppVeyor build is broken when downloading cmake. Do we have to update the cmake version we're using? The surprising thing is that I had another PR that didn't have this problem. |
| import javax.crypto.KeyGenerator; | ||
|
|
||
| /** | ||
| * Benchmark for comparing cipher encoding performance. |
There was a problem hiding this comment.
You should swap "encode" with "encrypt" throughout this class, the latter is orders of magnitude more commonly used when talking about what ciphers do.
Supporting perf work for #317
Supporting perf work for #317