Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark Oj::Parser in a thread safe way #703

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

casperisfine
Copy link

The documentation state Oj::Parser.usual isn't thread safe: https://github.com/ohler55/oj/blob/c70bf4125b546bc7146840b15de36460d42b4dff/ext/oj/parser.c#L1507-L1513

As such we shouldn't benchark it this way, but instantiate a new parser every time. Technically in real world scenarios you could create a pool of parsers and re-use them, but if it's not provided by the gem, I'm not sure we should go out of our way to do it.

@tenderlove

The documentation state `Oj::Parser.usual` isn't thread safe:
https://github.com/ohler55/oj/blob/c70bf4125b546bc7146840b15de36460d42b4dff/ext/oj/parser.c#L1507-L1513

As such we shouldn't benchark it this way, but instantiate a new
parser every time. Technically in real world scenarios you could
create a pool of parsers and re-use them, but if it's not provided
by the gem, I'm not sure we should go out of our way to do it.
@byroot byroot merged commit 821b92e into ruby:master Nov 8, 2024
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants