[CDRIVER-2957] Consider adding an option to disable all alignment specifiers Created: 11/Feb/19  Updated: 18/Jun/20  Resolved: 18/Jun/20

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-2880 Struct alignment is less then the def... Closed

 Description   

Despite -DENABLE_EXTRA_ALIGNMENT=OFF being a general improvement over our default large alignment specifiers (bson_t aligned at 128 bytes), users still run into issues with the alignment specifiers (e.g. CDRIVER-2880).

It seems tricky to get the alignment specifiers right in all situations. And I'm doubtful that we get any measurable performance improvements by changing alignment.

I think we should:

  • Run an experiment (perhaps with our benchmark suite) to see if turning off alignment entirely results in any performance drop.
  • If not, let's add a cmake option, like DISABLE_ALIGNMENT that removes alignment specifiers entirely.
  • Document that users should configure with this option.


 Comments   
Comment by Kevin Albertson [ 30/Apr/20 ]

Breaking ABI through the use of cmake options may be a bad practice. It increases the likelihood of multiple ABI incompatible versions of libbson being used. For example, if a user links libbson with alignment disabled, then links libfoo that statically links libbson with alignment enabled, runtime symbol resolution for libbson symbols could go to either library depending on the order of linking. If they're ABI incompatible, I believe this could cause a runtime crash.

Generated at Wed Feb 07 21:16:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.