- 
    Type:
Task
 - 
    Resolution: Unresolved
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        Query Execution
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
The doc_diff calculator is used on the pipeline update path for computing a diff between the update's pre-image and post-image. This code does roughly one allocation per diff-node, in order to build a diff tree.
This is rather inefficient and we should look into ways of avoiding the allocations. Namely,
- Restructure the code to avoid creating a tree at all. This may not be possible but is worth a look.
 - Allocate space for the tree nodes all at once. Essentially a bump allocator. There may also be generic infrastructure for this type of pattern that already exists, and if so, we should try to use it.
	
- This should be a good candidate for a bump allocator since we create the diff tree, generate a BSON from it, and then throw the diff tree away. The lifetime of the diff tree is relatively short and we dispose of the whole thing at once.
 
 
- related to
 - 
                    
SERVER-97097 Optimize doc_diff generation code for modifier style updates to do fewer allocations
-         
 - Open
 
 -