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

Small optim of frame serialization for puffin_http #239

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

gwen-lg
Copy link
Contributor

@gwen-lg gwen-lg commented Jan 23, 2025

Draft as it include some change from PR #237 & #238, merge it first.

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Optimization of the write of frame data before send to client with puffin_http.
Example :

  • remove some duplicate data : sequence length already manage by serde, no need to duplicate information.
  • directly serialize in Writer instead of serialize in buffer (Vec) before coping data in writer.
  • avoid cloning of scope_collection

Stats:

When tested with my test/example app puffin-test-app with 250 loops (who only do a sleep), I got this :

allocations Mean self time
Before 7322 166µs
After 6268 135.1µs

Note : Mean self time is for PuffinServerImpl::send

Related Issues

No listed issue.

The frame_view var is only added for use scope_collection member.
This change to directly use a ScopeCollection.
replace linked parameter scope_collection + bool send_all_scopes with an
Option<ScopeCollection>
It's not nessessary to use the toolchain specified for puffin.
And `cargo-vet` failed to build with 1.76 toolchain.
this is useless as already done by serde serialization.
BREAKING CHANGE: the frame serialization format change. Introducing PFD5
This allow to serialize scopes collection directly, without need to
collect scope in a temporary Vec.
instead of serialize in a temporary Vec<u8> before coping data in writer after.
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.

1 participant