Skip to content

Reuse stack states during decoding to optimize GC load #228

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

Merged
merged 1 commit into from
Jul 22, 2023

Conversation

sergeyzenchenko
Copy link
Collaborator

@sergeyzenchenko sergeyzenchenko commented Apr 27, 2023

hey @gfx found optimisation that I've missed somehow 2 years ago :D

StackStates are constantly being created for each array or map parsed.

If for example we parse array with 10k objects inside, it will allocate 10001 stack states, but in reality we only need 2 allocations. Max amount of allocation equals the max depth of nested objects/arrays inside on payload.

I've run msgpack benchmark, but it didn't show any large improvements. But I think these tests can't show it because they are very short living and GC have no time to kick off.

Change is simple and can have meaningful impact of apps processing large amount of data.

Also unified stack state object creation with fields from both types created in one place should have impact on V8 optimisation pipeline, because now each object will have the same shape.

@sergeyzenchenko sergeyzenchenko requested a review from gfx April 27, 2023 14:10
@gfx
Copy link
Member

gfx commented Jul 22, 2023

It totally makes sense. Thank you.

@gfx gfx merged commit f95b15b into msgpack:main Jul 22, 2023
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy