Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engineccl: Use crypto/subtle.XORBytes #115454

Merged
merged 1 commit into from
Dec 20, 2023
Merged

Conversation

bdarnell
Copy link
Contributor

@bdarnell bdarnell commented Dec 1, 2023

This function (new in Go 1.20) is faster than our hand-written xor loop. This is good for a nearly 15% increase in encryption throughput (for standard intel builds. 5% in fips mode, 20% on Apple M2)

Release note (performance improvement): Improved performance of encryption-at-rest.
Epic: None

bdarnell@gceworker-bdarnell-fips:~/go/src/github.com/cockroachdb/cockroach$ ~/go/bin/benchstat before.bench after-xor.bench goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                                                    │ before.bench │           after-xor.bench           │
                                                    │    sec/op    │   sec/op     vs base                │
FileCipherStream/fips=false/key=128/block=16/-24       64.63n ± 0%   57.87n ± 2%  -10.45% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-24     2.221µ ± 0%   1.884µ ± 0%  -15.17% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-24    21.75µ ± 0%   18.49µ ± 0%  -14.97% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-24       66.86n ± 1%   60.85n ± 1%   -9.00% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-24     2.381µ ± 0%   2.037µ ± 0%  -14.47% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-24    23.34µ ± 0%   20.02µ ± 0%  -14.24% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-24       69.34n ± 1%   63.02n ± 1%   -9.11% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-24     2.541µ ± 0%   2.188µ ± 0%  -13.88% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-24    24.95µ ± 0%   21.51µ ± 0%  -13.80% (p=0.000 n=10)
geomean                                                1.548µ        1.349µ       -12.82%

                                                    │ before.bench │           after-xor.bench            │
                                                    │     B/s      │     B/s       vs base                │
FileCipherStream/fips=false/key=128/block=16/-24      236.1Mi ± 0%   263.7Mi ± 2%  +11.67% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-24    439.7Mi ± 0%   518.3Mi ± 0%  +17.89% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-24   449.0Mi ± 0%   528.1Mi ± 0%  +17.61% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-24      228.2Mi ± 1%   250.8Mi ± 1%   +9.89% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-24    410.0Mi ± 0%   479.4Mi ± 0%  +16.93% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-24   418.3Mi ± 0%   487.8Mi ± 0%  +16.61% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-24      220.1Mi ± 1%   242.1Mi ± 1%  +10.04% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-24    384.4Mi ± 0%   446.4Mi ± 0%  +16.12% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-24   391.4Mi ± 0%   454.1Mi ± 0%  +16.01% (p=0.000 n=10)
geomean                                               339.8Mi        389.8Mi       +14.71%
bdarnell@gceworker-bdarnell-fips:~/go/src/github.com/cockroachdb/cockroach$ ~/go/bin/benchstat before-fips.bench after-xor-fips.bench
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                                                   │ before-fips.bench │        after-xor-fips.bench        │
                                                   │      sec/op       │   sec/op     vs base               │
FileCipherStream/fips=true/key=128/block=16/-24            270.9n ± 0%   259.2n ± 1%  -4.32% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=1024/-24          14.86µ ± 0%   14.04µ ± 0%  -5.52% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=10240/-24         149.2µ ± 1%   140.8µ ± 1%  -5.60% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=16/-24            272.3n ± 1%   260.4n ± 1%  -4.37% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=1024/-24          14.98µ ± 1%   14.17µ ± 1%  -5.41% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=10240/-24         149.3µ ± 0%   141.9µ ± 1%  -4.92% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=16/-24            273.7n ± 1%   261.3n ± 1%  -4.53% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=1024/-24          15.02µ ± 1%   14.23µ ± 2%  -5.28% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=10240/-24         150.0µ ± 1%   142.4µ ± 1%  -5.09% (p=0.000 n=10)
geomean                                                    8.475µ        8.051µ       -5.01%

                                                   │ before-fips.bench │        after-xor-fips.bench         │
                                                   │        B/s        │     B/s       vs base               │
FileCipherStream/fips=true/key=128/block=16/-24           56.33Mi ± 0%   58.87Mi ± 1%  +4.50% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=1024/-24         65.71Mi ± 0%   69.55Mi ± 0%  +5.83% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=10240/-24        65.46Mi ± 1%   69.35Mi ± 1%  +5.94% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=16/-24           56.04Mi ± 1%   58.60Mi ± 1%  +4.57% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=1024/-24         65.20Mi ± 1%   68.93Mi ± 1%  +5.72% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=10240/-24        65.42Mi ± 0%   68.80Mi ± 1%  +5.17% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=16/-24           55.75Mi ± 1%   58.39Mi ± 1%  +4.74% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=1024/-24         65.00Mi ± 1%   68.63Mi ± 2%  +5.58% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=10240/-24        65.11Mi ± 1%   68.60Mi ± 1%  +5.36% (p=0.000 n=10)
geomean                                                   62.07Mi        65.33Mi       +5.27%

@bdarnell bdarnell requested a review from a team as a code owner December 1, 2023 20:54
@bdarnell bdarnell requested a review from jbowens December 1, 2023 20:54
Copy link

blathers-crl bot commented Dec 1, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@bdarnell
Copy link
Contributor Author

bdarnell commented Dec 1, 2023

I promised (threatened?) to send @rsevinsky-cr a crypto/subtle PR, so here it is :) But I think I've got another approach that will be even better and make this one moot (unless this one is more backportable because it's a very safe change).

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jbowens and @rsevinsky-cr)

This function (new in Go 1.20) is faster than our hand-written xor loop.
This is good for a nearly 15% increase in encryption throughput (for
standard intel builds. 5% in fips mode, 20% on Apple M2)

Release note (performance improvement): Improved performance of
encryption-at-rest.
Epic: None

bdarnell@gceworker-bdarnell-fips:~/go/src/github.com/cockroachdb/cockroach$ ~/go/bin/benchstat before.bench after-xor.bench
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                                                    │ before.bench │           after-xor.bench           │
                                                    │    sec/op    │   sec/op     vs base                │
FileCipherStream/fips=false/key=128/block=16/-24       64.63n ± 0%   57.87n ± 2%  -10.45% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-24     2.221µ ± 0%   1.884µ ± 0%  -15.17% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-24    21.75µ ± 0%   18.49µ ± 0%  -14.97% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-24       66.86n ± 1%   60.85n ± 1%   -9.00% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-24     2.381µ ± 0%   2.037µ ± 0%  -14.47% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-24    23.34µ ± 0%   20.02µ ± 0%  -14.24% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-24       69.34n ± 1%   63.02n ± 1%   -9.11% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-24     2.541µ ± 0%   2.188µ ± 0%  -13.88% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-24    24.95µ ± 0%   21.51µ ± 0%  -13.80% (p=0.000 n=10)
geomean                                                1.548µ        1.349µ       -12.82%

                                                    │ before.bench │           after-xor.bench            │
                                                    │     B/s      │     B/s       vs base                │
FileCipherStream/fips=false/key=128/block=16/-24      236.1Mi ± 0%   263.7Mi ± 2%  +11.67% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-24    439.7Mi ± 0%   518.3Mi ± 0%  +17.89% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-24   449.0Mi ± 0%   528.1Mi ± 0%  +17.61% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-24      228.2Mi ± 1%   250.8Mi ± 1%   +9.89% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-24    410.0Mi ± 0%   479.4Mi ± 0%  +16.93% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-24   418.3Mi ± 0%   487.8Mi ± 0%  +16.61% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-24      220.1Mi ± 1%   242.1Mi ± 1%  +10.04% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-24    384.4Mi ± 0%   446.4Mi ± 0%  +16.12% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-24   391.4Mi ± 0%   454.1Mi ± 0%  +16.01% (p=0.000 n=10)
geomean                                               339.8Mi        389.8Mi       +14.71%
bdarnell@gceworker-bdarnell-fips:~/go/src/github.com/cockroachdb/cockroach$ ~/go/bin/benchstat before-fips.bench after-xor-fips.bench
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                                                   │ before-fips.bench │        after-xor-fips.bench        │
                                                   │      sec/op       │   sec/op     vs base               │
FileCipherStream/fips=true/key=128/block=16/-24            270.9n ± 0%   259.2n ± 1%  -4.32% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=1024/-24          14.86µ ± 0%   14.04µ ± 0%  -5.52% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=10240/-24         149.2µ ± 1%   140.8µ ± 1%  -5.60% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=16/-24            272.3n ± 1%   260.4n ± 1%  -4.37% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=1024/-24          14.98µ ± 1%   14.17µ ± 1%  -5.41% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=10240/-24         149.3µ ± 0%   141.9µ ± 1%  -4.92% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=16/-24            273.7n ± 1%   261.3n ± 1%  -4.53% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=1024/-24          15.02µ ± 1%   14.23µ ± 2%  -5.28% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=10240/-24         150.0µ ± 1%   142.4µ ± 1%  -5.09% (p=0.000 n=10)
geomean                                                    8.475µ        8.051µ       -5.01%

                                                   │ before-fips.bench │        after-xor-fips.bench         │
                                                   │        B/s        │     B/s       vs base               │
FileCipherStream/fips=true/key=128/block=16/-24           56.33Mi ± 0%   58.87Mi ± 1%  +4.50% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=1024/-24         65.71Mi ± 0%   69.55Mi ± 0%  +5.83% (p=0.000 n=10)
FileCipherStream/fips=true/key=128/block=10240/-24        65.46Mi ± 1%   69.35Mi ± 1%  +5.94% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=16/-24           56.04Mi ± 1%   58.60Mi ± 1%  +4.57% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=1024/-24         65.20Mi ± 1%   68.93Mi ± 1%  +5.72% (p=0.000 n=10)
FileCipherStream/fips=true/key=192/block=10240/-24        65.42Mi ± 0%   68.80Mi ± 1%  +5.17% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=16/-24           55.75Mi ± 1%   58.39Mi ± 1%  +4.74% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=1024/-24         65.00Mi ± 1%   68.63Mi ± 2%  +5.58% (p=0.000 n=10)
FileCipherStream/fips=true/key=256/block=10240/-24        65.11Mi ± 1%   68.60Mi ± 1%  +5.36% (p=0.000 n=10)
geomean                                                   62.07Mi        65.33Mi       +5.27%

bdarnell@Bens-MBP-2 cockroach % ~/go/bin/benchstat before-mac.bench after-mac.bench
goos: darwin
goarch: arm64
                                                    │ before-mac.bench │           after-mac.bench           │
                                                    │      sec/op      │   sec/op     vs base                │
FileCipherStream/fips=false/key=128/block=16/-12           29.64n ± 0%   24.76n ± 1%  -16.48% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-12        1101.5n ± 1%   841.2n ± 0%  -23.63% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-12       10.827µ ± 1%   8.273µ ± 0%  -23.59% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-12           29.85n ± 1%   25.65n ± 0%  -14.05% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-12        1104.5n ± 1%   904.6n ± 0%  -18.10% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-12       10.845µ ± 1%   8.907µ ± 0%  -17.87% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-12           30.56n ± 0%   27.18n ± 0%  -11.03% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-12        1139.0n ± 1%   976.3n ± 1%  -14.29% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-12       11.272µ ± 2%   9.629µ ± 2%  -14.58% (p=0.000 n=10)
geomean                                                    716.2n        593.2n       -17.17%

                                                    │ before-mac.bench │            after-mac.bench            │
                                                    │       B/s        │      B/s       vs base                │
FileCipherStream/fips=false/key=128/block=16/-12          514.7Mi ± 0%    616.3Mi ± 1%  +19.75% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=1024/-12        886.4Mi ± 1%   1160.9Mi ± 0%  +30.96% (p=0.000 n=10)
FileCipherStream/fips=false/key=128/block=10240/-12       902.0Mi ± 1%   1180.4Mi ± 0%  +30.87% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=16/-12          511.2Mi ± 1%    594.7Mi ± 0%  +16.35% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=1024/-12        884.2Mi ± 1%   1079.5Mi ± 0%  +22.09% (p=0.000 n=10)
FileCipherStream/fips=false/key=192/block=10240/-12       900.5Mi ± 1%   1096.4Mi ± 0%  +21.75% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=16/-12          499.3Mi ± 0%    561.4Mi ± 0%  +12.42% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=1024/-12        857.2Mi ± 1%   1000.3Mi ± 1%  +16.69% (p=0.000 n=10)
FileCipherStream/fips=false/key=256/block=10240/-12       866.4Mi ± 3%   1014.2Mi ± 2%  +17.06% (p=0.000 n=10)
geomean                                                   734.4Mi         886.6Mi       +20.73%
@bdarnell
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Dec 20, 2023

Build succeeded:

@craig craig bot merged commit 2c4c877 into cockroachdb:master Dec 20, 2023
9 checks passed
@bdarnell bdarnell deleted the ctr-xor2 branch December 20, 2023 20:31
craig bot pushed a commit that referenced this pull request Jan 29, 2024
115549: engineccl: Reimplement FileCipherStreamV2 r=bdarnell a=bdarnell

First commit is from #115365. #115454 is related and makes v1 look a little better in the benchmarks. 

The new implementation, fileCipherStreamV2, is currently only hooked up
in tests and benchmarks. It's not used in production until we decide on
a feature flagging strategy.

The major change is to defer more to the standard library, and
specifically to pass larger batches to the stdlib at once. Previously we
made a separate call to the crypto library for every 16-byte block; now
we pass the entire buffer at once. The downside is random access is more
expensive. The previous implementation was basically constant-time,
while the new one performs multiple heap allocations for every "seek".

To summarize the performance results below, v2 is significantly slower
than v1 for tiny (16 byte) non-sequential operations. It is about the
same performance for small sequential operations, and substantially
faster for large sequential operations (about twice as fast as the
original version).

The FIPS version is now even faster (for large sequential writes) than
non-FIPS. This is because Go's implementation of CTR mode has not been
as extensively optimized as openssl's. There are open PRs that may
improve this in the future, such as golang/go#53503

```
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=false/block=16/-24                 7521            137392 ns/op         238.50 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=false/block=256/-24               15793             75349 ns/op         434.88 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=false/block=1024/-24              16778             71159 ns/op         460.49 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=false/block=16384/-24             17083             69697 ns/op         470.15 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=true/block=16/-24                  7797            137415 ns/op         238.46 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=true/block=256/-24                15794             75635 ns/op         433.24 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=true/block=1024/-24               16785             71195 ns/op         460.26 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=128/seq=true/block=16384/-24              17169             69813 ns/op         469.37 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=false/block=16/-24                 7510            142334 ns/op         230.22 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=false/block=256/-24               14797             81525 ns/op         401.94 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=false/block=1024/-24              15715             76005 ns/op         431.13 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=false/block=16384/-24             15985             74794 ns/op         438.11 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=true/block=16/-24                  7558            142334 ns/op         230.22 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=true/block=256/-24                14826             80456 ns/op         407.28 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=true/block=1024/-24               15757             76231 ns/op         429.85 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=192/seq=true/block=16384/-24              16063             74763 ns/op         438.29 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=false/block=16/-24                 7304            146606 ns/op         223.51 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=false/block=256/-24               13947             85653 ns/op         382.57 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=false/block=1024/-24              14589             81277 ns/op         403.16 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=false/block=16384/-24             14989             80079 ns/op         409.19 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=true/block=16/-24                  7274            145928 ns/op         224.55 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=true/block=256/-24                13935             85680 ns/op         382.45 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=true/block=1024/-24               14690             81366 ns/op         402.73 MB/s
BenchmarkFileCipherStream/fips=false/impl=v1/key=256/seq=true/block=16384/-24              15002             80120 ns/op         408.99 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=false/block=16/-24                  615           1896677 ns/op          17.28 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=false/block=256/-24                9006            119509 ns/op         274.19 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=false/block=1024/-24              23329             51281 ns/op         638.99 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=false/block=16384/-24             29162             40910 ns/op         800.97 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=true/block=16/-24                  8750            132576 ns/op         247.16 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=true/block=256/-24                26404             45361 ns/op         722.39 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=true/block=1024/-24               28626             41808 ns/op         783.78 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=128/seq=true/block=16384/-24              29336             40935 ns/op         800.48 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=false/block=16/-24                  574           2042367 ns/op          16.04 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=false/block=256/-24                8706            129528 ns/op         252.98 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=false/block=1024/-24              21183             56446 ns/op         580.52 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=false/block=16384/-24             26109             45655 ns/op         717.73 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=true/block=16/-24                  8504            137355 ns/op         238.56 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=true/block=256/-24                23960             50296 ns/op         651.50 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=true/block=1024/-24               25696             46679 ns/op         701.99 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=192/seq=true/block=16384/-24              26198             45587 ns/op         718.80 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=false/block=16/-24                  531           2206987 ns/op          14.85 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=false/block=256/-24                7694            139498 ns/op         234.90 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=false/block=1024/-24              19524             61046 ns/op         536.77 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=false/block=16384/-24             23745             50562 ns/op         648.07 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=true/block=16/-24                  8245            148016 ns/op         221.38 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=true/block=256/-24                21739             55280 ns/op         592.76 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=true/block=1024/-24               23212             51531 ns/op         635.89 MB/s
BenchmarkFileCipherStream/fips=false/impl=v2/key=256/seq=true/block=16384/-24              23805             50438 ns/op         649.66 MB/s
PASS
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=false/block=16/-24                  2050            569817 ns/op          57.51 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=false/block=256/-24                 2499            490116 ns/op          66.86 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=false/block=1024/-24                2473            478146 ns/op          68.53 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=false/block=16384/-24               2518            477786 ns/op          68.58 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=true/block=16/-24                   2067            566694 ns/op          57.82 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=true/block=256/-24                  2448            488315 ns/op          67.10 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=true/block=1024/-24                 2490            479422 ns/op          68.35 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=128/seq=true/block=16384/-24                2514            481941 ns/op          67.99 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=false/block=16/-24                  2008            568220 ns/op          57.67 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=false/block=256/-24                 2407            493184 ns/op          66.44 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=false/block=1024/-24                2428            480403 ns/op          68.21 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=false/block=16384/-24               2421            482593 ns/op          67.90 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=true/block=16/-24                   2040            573229 ns/op          57.16 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=true/block=256/-24                  2314            496560 ns/op          65.99 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=true/block=1024/-24                 2478            476019 ns/op          68.84 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=192/seq=true/block=16384/-24                2449            483360 ns/op          67.79 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=false/block=16/-24                  1998            574193 ns/op          57.07 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=false/block=256/-24                 2356            488059 ns/op          67.14 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=false/block=1024/-24                2454            482139 ns/op          67.96 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=false/block=16384/-24               2446            483249 ns/op          67.81 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=true/block=16/-24                   2020            565348 ns/op          57.96 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=true/block=256/-24                  2388            488736 ns/op          67.05 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=true/block=1024/-24                 2418            492126 ns/op          66.58 MB/s
BenchmarkFileCipherStream/fips=true/impl=v1/key=256/seq=true/block=16384/-24                2443            480180 ns/op          68.24 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=false/block=16/-24                   259           4733741 ns/op           6.92 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=false/block=256/-24                 3481            297358 ns/op         110.20 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=false/block=1024/-24               14671             82314 ns/op         398.08 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=false/block=16384/-24             135296              9077 ns/op        3609.94 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=true/block=16/-24                   2421            452063 ns/op          72.49 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=true/block=256/-24                 33729             36362 ns/op         901.15 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=true/block=1024/-24                81376             15570 ns/op        2104.61 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=128/seq=true/block=16384/-24              139063              8704 ns/op        3764.70 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=false/block=16/-24                   244           5070212 ns/op           6.46 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=false/block=256/-24                 3350            313168 ns/op         104.63 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=false/block=1024/-24               14427             85797 ns/op         381.93 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=false/block=16384/-24             114337             10014 ns/op        3272.32 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=true/block=16/-24                   2611            452229 ns/op          72.46 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=true/block=256/-24                 32545             37458 ns/op         874.79 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=true/block=1024/-24                72807             16660 ns/op        1966.85 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=192/seq=true/block=16384/-24              116131              9992 ns/op        3279.30 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=false/block=16/-24                   247           4896561 ns/op           6.69 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=false/block=256/-24                 3409            336213 ns/op          97.46 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=false/block=1024/-24               13916             86875 ns/op         377.18 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=false/block=16384/-24             101763             11161 ns/op        2936.06 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=true/block=16/-24                   2326            452598 ns/op          72.40 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=true/block=256/-24                 30164             37851 ns/op         865.70 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=true/block=1024/-24                68094             17592 ns/op        1862.67 MB/s
BenchmarkFileCipherStream/fips=true/impl=v2/key=256/seq=true/block=16384/-24              104826             11190 ns/op        2928.36 MB/s
```

Co-authored-by: Ben Darnell <ben@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants