Skip to content

lib/db, lib/protocol: Compact FileInfo and BlockInfo alignment - #6215

Merged
calmh merged 2 commits into
syncthing:masterfrom
calmh:structalign
Dec 8, 2019
Merged

calmh merged 2 commits into
syncthing:masterfrom
calmh:structalign

Conversation

@calmh

@calmh calmh commented Dec 8, 2019

Copy link
Copy Markdown
Member

This fixes the following two lint warnings

FileInfo: struct of size 160 bytes could be of size 136 bytes
BlockInfo: struct of size 48 bytes could be of size 40 bytes

by reordering fields in alignment order (64 bit fields, then 32 bit
fields, then 16 bit fields (if any), then small ones). The end result is
a slightly less aesthetically pleasing struct field order, but since
these are the objects we often juggle in bulk and keep large queues of I
think it's worth it.

It's a micro optimization, but a cheap one.

calmh added 2 commits December 8, 2019 11:01
This fixes the following two lint warnings

    FileInfo: struct of size 160 bytes could be of size 136 bytes
    BlockInfo: struct of size 48 bytes could be of size 40 bytes

by reordering fields in alignment order (64 bit fields, then 32 bit
fields, then 16 bit fields (if any), then small ones). The end result is
a slightly less aesthetically pleasing struct field order, but since
these are the objects we often juggle in bulk and keep large queues of I
think it's worth it.

It's a micro optimization, but a cheap one.
@calmh
calmh merged commit 325c3c1 into syncthing:master Dec 8, 2019
@calmh
calmh deleted the structalign branch December 8, 2019 12:31
calmh added a commit to calmh/syncthing that referenced this pull request Dec 8, 2019
* master:
  lib/db, lib/protocol: Compact FileInfo and BlockInfo alignment (syncthing#6215)
@calmh calmh added this to the v1.3.3 milestone Dec 8, 2019
calmh added a commit to calmh/syncthing that referenced this pull request Jan 4, 2020
* master:
  gui, lib/model: Prevent negative sync completion (fixes syncthing#4570) (syncthing#6248)
  build, pmp: Replace fork with upstream for go-nat-pmp and tidy go.mod (syncthing#6247)
  gui: Missing line break (fixes syncthing#6240) (syncthing#6241)
  docker: Fix HOME setting (fixes syncthing#6234) (syncthing#6235)
  golangci: Skip godox
  build(deps): bump github.com/mattn/go-isatty from 0.0.10 to 0.0.11 (syncthing#6231)
  lib/upgrade: Let Mac load .zip archives (syncthing#6230)
  lib/api: Prevent leaks in tests (syncthing#6227)
  lib/syncthing: Expose backend instead of lowlevel (syncthing#6224)
  gui: Prevent spurious api call (fixes syncthing#6222) (syncthing#6223)
  gui: Fix a typo in a class name (syncthing#6220)
  gui: Allow to degrade 'Automatic upgrades' option to 'No upgrades' (fixes syncthing#6044) (syncthing#6168)
  lib/db, lib/protocol: Compact FileInfo and BlockInfo alignment (syncthing#6215)
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Dec 8, 2020
@syncthing syncthing locked and limited conversation to collaborators Dec 8, 2020
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