[SERVER-78003] Avoid dynamic_cast in $not serialization Created: 12/Jun/23  Updated: 29/Oct/23  Resolved: 26/Jun/23

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

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Charlie Swanson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File baseline.svg     File static_cast_v1.svg    
Issue Links:
Depends
is depended on by SERVER-85055 Tracking: M1 Performance improvement ... Closed
Backwards Compatibility: Fully Compatible
Sprint: QO 2023-06-26
Participants:

 Description   

When looking at the performance profile for our new $queryStats workload, I noticed a lot of time spent in __dynamic_cast when computing the shape of {$exists: false} queries which translate into {$not: {$exists: true}}. It was this line, which doesn't seem to need to use dynamic_cast and can use `matchType()` to figure it out instead.

I didn't see any other obvious usages of dynamic_cast in src/mongo/db/matcher's serialization functions.



 Comments   
Comment by Githook User [ 26/Jun/23 ]

Author:

{'name': 'Charlie Swanson', 'email': 'charlie.swanson@mongodb.com', 'username': 'cswanson310'}

Message: SERVER-78003 Avoid dynamic_cast in $not serialization
Branch: master
https://github.com/mongodb/mongo/commit/1cddd4409d51b14c0cdb84717e8520fbaedf88b5

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