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

Optimize fbuffer_inc_capa #597

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

casperisfine
Copy link

On my JSON.dump benchmark it shows up as 6% of runtime, compared to 40% for convert_UTF8_to_JSON.

Capture d’écran 2024-09-02 à 13 48 22

Since the vast majority of the time this function is called we still have some buffer capacity, we might as well check that first and skip the expensive loop etc.

With this change my profiler now report this function as 0.7%, so almost 10x better.

Capture d’écran 2024-09-02 à 13 48 34

On my `JSON.dump` benchmark it shows up as 6% of runtime, compared
to 40% for `convert_UTF8_to_JSON`.

Since the vast majority of the time this function is called we
still have some buffer capacity, we might as well check that
first and skip the expensive loop etc.

With this change my profiler now report this function as 0.7%,
so almost 10x better.
@hsbt hsbt merged commit ca77394 into ruby:master Oct 3, 2024
75 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