[SERVER-64036] Avoid making a copy of JsFunction when generating an SBE plan Created: 28/Feb/22  Updated: 17/Jan/24  Resolved: 07/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: Backlog
Fix Version/s: 5.3.0-rc3

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

Issue Links:
Depends
Related
related to SERVER-84152 tassert in expression_where.h In Progress
Backwards Compatibility: Fully Compatible
Sprint: QO 2022-03-07, QO 2022-03-21
Participants:
Linked BF Score: 15

 Description   

Currently when we construct an WhereMatchExpression we instantiate a JsFunction object, which is a wrapper encapsulating common logic for running JS code in $where expression.

When we translate this expression into an SBE plan, we make a copy of this JsFunction object, which is an expensive operation, since we re-parse and re-compile the JS function from scratch. Instead, we should reuse the original object stored in WhereMatchExpression since this expression will never need it again once translated into SBE.



 Comments   
Comment by Githook User [ 07/Mar/22 ]

Author:

{'name': 'Anton Korshunov', 'email': 'anton.korshunov@mongodb.com', 'username': 'antkorsh'}

Message: SERVER-64036 Avoid making a copy of JsFunction when generating an SBE plan
Branch: master
https://github.com/mongodb/mongo/commit/01a53e327026b3cef9f869669c81ca4d6c4ac460

Generated at Thu Feb 08 05:59:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.