Skip to content

lib/protocol: Optimize FileKey - #7440

Merged
calmh merged 1 commit into
syncthing:mainfrom
greatroar:encryption
Mar 7, 2021
Merged

calmh merged 1 commit into
syncthing:mainfrom
greatroar:encryption

Conversation

@greatroar

Copy link
Copy Markdown
Contributor

Use lib/sha256 to get the fast Minio hash, allocate the salt at init time. Benchmark results on Linux/amd64 with STHASHING=minio:

name       old time/op    new time/op    delta
FileKey-8    6.27µs ± 3%    4.58µs ± 3%  -26.91%  (p=0.000 n=20+19)

name       old alloc/op   new alloc/op   delta
FileKey-8    1.47kB ± 0%    1.17kB ± 0%  -20.58%  (p=0.000 n=20+20)

name       old allocs/op  new allocs/op  delta
FileKey-8      19.0 ± 0%      16.0 ± 0%  -15.79%  (p=0.000 n=20+20)

Use lib/sha256 to get the fast Minio hash, allocate the salt at init
time. Benchmark results on Linux/amd64 with STHASHING=minio:

name       old time/op    new time/op    delta
FileKey-8    6.27µs ± 3%    4.58µs ± 3%  -26.91%  (p=0.000 n=20+19)

name       old alloc/op   new alloc/op   delta
FileKey-8    1.47kB ± 0%    1.17kB ± 0%  -20.58%  (p=0.000 n=20+20)

name       old allocs/op  new allocs/op  delta
FileKey-8      19.0 ± 0%      16.0 ± 0%  -15.79%  (p=0.000 n=20+20)
@calmh
calmh merged commit c005202 into syncthing:main Mar 7, 2021
@st-release st-release added this to the v1.15.0 milestone Mar 9, 2021
calmh added a commit to calmh/syncthing that referenced this pull request Mar 11, 2021
* main:
  build: Update notify (syncthing#7444)
  next-gen-gui: Add button to restore default theme (syncthing#7433)
  lib/protocol: Optimize FileKey (syncthing#7440)
  cmd/syncthing, etc: Consistent failure restart backoff (syncthing#7439)
  lib: Return error from db.FileSet.Snapshot (fixes syncthing#7419, ref syncthing#5907) (syncthing#7424)
@greatroar
greatroar deleted the encryption branch September 12, 2021 20:04
@calmh calmh added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Aug 11, 2022
@syncthing syncthing locked and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants