Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(core): store cls contexts on a Map
Node.js v12 is affected by a V8 regression where many insert/deletes on a POJO will trigger an undefined state on V8, leading to a huge performance regression which can cause each insert/delete operations on that object to take hundreds of times more. The Map structure is not affected by this performance regression (and is recommended by engine developers to deal with large key/value stores). Contexts on cls-ah are stored on a POJO, and since inserts/deletes happen often (they are triggered by async_hooks on init and destroy), applications with high RPS or with high amount of async operations will hit the threshold, turning the regression on and leading to a huge performance overhead on each new async operation. Changing to a Map will avoid that issue. Ref: nodejs/node#31961
- Loading branch information