[SERVER-83514] Stop using stdx::variant internally in bulkWrite Created: 21/Nov/23  Updated: 07/Dec/23  Resolved: 07/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Vishnu Kaushik Assignee: Backlog - Replication Team
Resolution: Won't Fix Votes: 0
Labels: milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Participants:

 Description   

Currently we have the bulkWrite operation take in an ops array of the form array<variant<InsertOp, UpdateOp, DeleteOp>>. Internally (i.e. within the server code, from the parsing step onwards), we represent this as a std::vector<stdx::variant<BulkWriteInsertOp, ...>>.

But there isn't any need to do this internally. For example, internally we can maintain three different vectors - one for each type of operation - and during parsing we can append to the correct vector based on the type of operation and have some bookkeeping through indexes.

Likewise, during parsing, we can add to a vector of common fields (like nsInfo index) so that for any operation at some index, we just need to access the vector of common fields and we don't have to call visit() on a variant.

This should bring down overall bulkWrite execution time down by at least 1%.



 Comments   
Comment by Sean Zimmerman [ 07/Dec/23 ]

Not doing this as it would be very complicated to do and our performance is good enough as is

Generated at Thu Feb 08 06:52:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.