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

Use Fprintf instead of Sprintf+WriteString #319

Merged
merged 1 commit into from
Aug 31, 2017
Merged

Use Fprintf instead of Sprintf+WriteString #319

merged 1 commit into from
Aug 31, 2017

Conversation

nussjustin
Copy link
Contributor

No performance change, but avoids one allocation when (un)subscribing.

name                              old alloc/op   new alloc/op   delta
PublishSpeed-8                       0.00B          0.00B          ~     (all equal)
PubSubSpeed-8                         122B ± 0%      121B ± 0%   -1.14%  (p=0.000 n=5+4)
AsyncSubscriptionCreationSpeed-8    1.02kB ±28%    1.00kB ±28%     ~     (p=0.643 n=5+5)
SyncSubscriptionCreationSpeed-8     66.3kB ± 0%    66.3kB ± 0%   -0.02%  (p=0.008 n=5+5)
InboxCreation-8                      64.0B ± 0%     64.0B ± 0%     ~     (all equal)
Request-8                             693B ± 0%      693B ± 0%     ~     (p=1.000 n=4+5)
OldRequest-8                        2.44kB ± 0%    2.37kB ± 0%   -2.63%  (p=0.029 n=4+4)
PublishGobStruct-8                  14.1kB ± 0%    14.1kB ± 0%     ~     (p=0.921 n=5+5)
JsonMarshalStruct-8                   992B ± 0%      992B ± 0%     ~     (all equal)
PublishJsonStruct-8                 3.78kB ± 0%    3.78kB ± 0%     ~     (p=1.000 n=4+4)
PublishSpeedViaChan-8                 169B ± 0%      169B ± 0%     ~     (all equal)
ProtobufMarshalStruct-8               712B ± 0%      712B ± 0%     ~     (all equal)
PublishProtobufStruct-8             2.70kB ± 1%    2.71kB ± 1%     ~     (p=0.629 n=4+4)

name                              old allocs/op  new allocs/op  delta
PublishSpeed-8                        0.00           0.00          ~     (all equal)
PubSubSpeed-8                         3.00 ± 0%      3.00 ± 0%     ~     (all equal)
AsyncSubscriptionCreationSpeed-8      12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.029 n=4+4)
SyncSubscriptionCreationSpeed-8       12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.008 n=5+5)
InboxCreation-8                       2.00 ± 0%      2.00 ± 0%     ~     (all equal)
Request-8                             14.0 ± 0%      14.0 ± 0%     ~     (all equal)
OldRequest-8                          52.0 ± 0%      50.0 ± 0%   -3.85%  (p=0.008 n=5+5)
PublishGobStruct-8                     330 ± 0%       330 ± 0%     ~     (all equal)
JsonMarshalStruct-8                   11.0 ± 0%      11.0 ± 0%     ~     (all equal)
PublishJsonStruct-8                   66.0 ± 0%      66.0 ± 0%     ~     (all equal)
PublishSpeedViaChan-8                 3.00 ± 0%      3.00 ± 0%     ~     (all equal)
ProtobufMarshalStruct-8               14.0 ± 0%      14.0 ± 0%     ~     (all equal)
PublishProtobufStruct-8               66.0 ± 0%      66.0 ± 0%     ~     (all equal)

Avoids one allocation when creating a subscription.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.512% when pulling fb22414 on nussjustin:fprintf into acf11e4 on nats-io:master.

@tylertreat
Copy link
Contributor

lgtm

@kozlovic
Copy link
Member

LGTM

@tylertreat tylertreat merged commit 0977874 into nats-io:master Aug 31, 2017
@nussjustin nussjustin deleted the fprintf branch August 31, 2017 16:42
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.

4 participants