[CSHARP-1116] Support alternate strategies for input and output buffers Created: 20/Nov/14  Updated: 06/Apr/15  Resolved: 06/Apr/15

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 2.0

Type: Improvement Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The requirements for input and output buffers are sufficiently different that it would be good to support alternate strategies for each of the two directions.

For input buffers:

  • the total required size is known in advance
  • for very small buffers it would be better to just allocate one from the heap
  • for larger buffers, we can optimize the sizes of the segments given that we know the total size required in advance

For output buffers:

  • the total size is NOT known in advance
  • most messages will end up being small, but we can't tell in advance
  • so we should start with a single relatively small segment (1K?) allocated from the heap
  • if that turns out to be enough, great, otherwise start grabbing increasingly larger segments from an underlying source (presumably pooled)

Note: this would not require any new interfaces, just alternate implementations of the IBsonChunkSource interface proposed in CSHARP-1115.



 Comments   
Comment by Robert Stam [ 06/Apr/15 ]

Initial work on this ticket was done in this commit:

https://github.com/mongodb/mongo-csharp-driver/commit/5001736827979f658fc7a952284d80298f1e98d4

But the commit message did not include the JIRA ticket number.

See the new InputBufferChunkSource and OutputBufferChunkSource classes.

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