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

Implemented streaming writer #621

Merged
merged 5 commits into from
Jan 7, 2021

Conversation

slinkydeveloper
Copy link
Member

@slinkydeveloper slinkydeveloper commented Nov 25, 2020

Like #618, but from event to bytes.

A thing to notice of this streaming writer is that it writes the event fields in an order such that the parser of #618 can efficiently parse it, without buffering some fields.

Note that the marshal tests and others had to be changed because they were doing a string comparison, but the new marshaller writes the elements in a different order. Also, the unmarshalling to map uses always floats even for integers. But, semantically speaking, there is no diff with the previous code.

Results:

name                                                                               old time/op    new time/op    delta
Marshal/number_data_v1.0-8                                                           17.1µs ± 5%     5.9µs ± 4%  -65.44%  (p=0.008 n=5+5)
Marshal/struct_data_v0.3-8                                                           27.5µs ± 3%     9.2µs ± 2%  -66.52%  (p=0.008 n=5+5)
Marshal/nil_data_v0.3-8                                                              26.0µs ± 0%     9.0µs ± 1%  -65.39%  (p=0.008 n=5+5)
Marshal/string_data_v0.3-8                                                           28.2µs ± 0%     9.2µs ± 2%  -67.30%  (p=0.008 n=5+5)
Marshal/struct_data_v1.0-8                                                           29.0µs ± 0%     8.3µs ± 0%  -71.26%  (p=0.016 n=5+4)
Marshal/nil_data_v1.0-8                                                              26.5µs ± 0%     8.6µs ± 4%  -67.48%  (p=0.008 n=5+5)
Marshal/string_data_v1.0-8                                                           28.9µs ± 1%     8.8µs ± 1%  -69.55%  (p=0.008 n=5+5)
Marshal/base64_json_encoded_data_v1.0-8                                              19.2µs ± 0%     5.9µs ± 1%  -68.99%  (p=0.008 n=5+5)

name                                                                               old alloc/op   new alloc/op   delta
Marshal/number_data_v1.0-8                                                           5.16kB ± 0%    3.88kB ± 0%  -24.70%  (p=0.008 n=5+5)
Marshal/struct_data_v0.3-8                                                           8.76kB ± 0%    4.48kB ± 0%     ~     (p=0.079 n=4+5)
Marshal/nil_data_v0.3-8                                                              7.15kB ± 0%    4.55kB ± 0%  -36.34%  (p=0.029 n=4+4)
Marshal/string_data_v0.3-8                                                           8.76kB ± 0%    4.45kB ± 0%  -49.16%  (p=0.008 n=5+5)
Marshal/struct_data_v1.0-8                                                           9.04kB ± 0%    4.44kB ± 0%     ~     (p=0.079 n=4+5)
Marshal/nil_data_v1.0-8                                                              7.44kB ± 0%    4.52kB ± 0%  -39.30%  (p=0.008 n=5+5)
Marshal/string_data_v1.0-8                                                           9.04kB ± 0%    4.44kB ± 0%     ~     (p=0.079 n=4+5)
Marshal/base64_json_encoded_data_v1.0-8                                              5.32kB ± 0%    3.56kB ± 0%  -33.00%  (p=0.008 n=5+5)

name                                                                               old allocs/op  new allocs/op  delta
Marshal/number_data_v1.0-8                                                              106 ± 0%        41 ± 0%  -61.32%  (p=0.008 n=5+5)
Marshal/struct_data_v0.3-8                                                              134 ± 0%        52 ± 0%  -61.19%  (p=0.008 n=5+5)
Marshal/nil_data_v0.3-8                                                                 130 ± 0%        52 ± 0%  -60.00%  (p=0.008 n=5+5)
Marshal/string_data_v0.3-8                                                              134 ± 0%        52 ± 0%  -61.19%  (p=0.008 n=5+5)
Marshal/struct_data_v1.0-8                                                              134 ± 0%        50 ± 0%  -62.69%  (p=0.008 n=5+5)
Marshal/nil_data_v1.0-8                                                                 130 ± 0%        50 ± 0%  -61.54%  (p=0.008 n=5+5)
Marshal/string_data_v1.0-8                                                              134 ± 0%        50 ± 0%  -62.69%  (p=0.008 n=5+5)
Marshal/base64_json_encoded_data_v1.0-8                                                 108 ± 0%        42 ± 0%  -61.11%  (p=0.008 n=5+5)

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Copy link
Member

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I want to see what this does for perf downstream :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants