- 
    Type:Task 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    None
- 
    Affects Version/s: None
- 
    Component/s: BSON, BSON-EXT, Performance
Use Case
As a... driver engineer
I want... to create a performance testing library for bson and bson-ext
So that... we can track js-bson's performance and compare its performance to bson-ext
User Impact
- N/A
Dependencies
- N/A
Unknowns
- How should benchmark runs be timed?
	- Timing individual iterations and then calculating summary statistics
- Record time elapsed during execution of all iterations and use this to find mean time
 
- Do we want this library to be publicly available on npm?
- What do we want to name the repo?
	- We want to create a parent tooling repo for other driver tooling that the benchmark runner will live under
		- dbx-js-tools
 
- bson-bench?
- mongodb-js-bench?
 
- We want to create a parent tooling repo for other driver tooling that the benchmark runner will live under
		
- Under which organization?
	- mongodb-js
 
- Should we add CI config in the benchmark repo to ensure that the benchmark runner runs on all of the required node.js versions?
	- yes
 
Acceptance Criteria
Implementation Requirements
- Implemen library in a new repository
	- create dbx-js-tools repo under mongodb-js organization
- create bson-bench as first sub-package in dbx-js-tools repo
- use driver config files to set up the following for bson-bench
		- package.json metadata
- tsconfig.json
- mocharc.json
- eslintrc.json
 
 
- Be sure not to use any Node.js features incompatible with Node.js >= 16.20.1
- Implement Task class
	- Implement package installation functionality
- Implement benchmark running Task.run
		- process spawning
- reading benchmark files
- selecting library function under test
- recording results via perf_hooks
- generating task names
- writing results to file
 
 
- Implement Suite class
	- Implement running of Tasks
- Implement collection of results from child TasksĀ and writing to file
 
Testing Requirements
- See Test Plan for benchmark runner here
- Manually test that we can import the bson-bench library with npm using git tags/commits
- Set up Github CI to run unit tests against Node 16, 18, 20, latest
Documentation Requirements
- Create Readme and inline documentation on how to use this library
Follow Up Requirements
- N/A