Add a JSON.parse function which can receive re-usable objects from an object pool #7570
jdgriffith
started this conversation in
Ideas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In certain high ingestion scenarios from a websocket, it might be advantageous to use an object pool of pre-initialized objects which can be used for JSON parsing where a new object does not need to be created. This could help in several ways as it could help tell the JSON parser the shape of the data and also no new memory needs to be allocated for the object. Once an object is finished being utilized by processing, it could be given back to the object pool. I'm not asking for Bun to create an API for an object pool (but I'm not opposed!) but I am asking for more logic on the JSON processing side - the ability to pass an object along with the JSON string.
or
I'm curious if my thought about this helping with performance would hold true in this scenario but it's an interesting thought. I wonder what others think of this proposal.
Beta Was this translation helpful? Give feedback.
All reactions