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

Fix compressed length calculations for escaped names #850

Merged
merged 5 commits into from
Nov 30, 2018

Conversation

tmthrgd
Copy link
Collaborator

@tmthrgd tmthrgd commented Nov 30, 2018

Performance hit incoming.

Len will now take escaping into account and return the correct length regardless of escaping.

These are the benchmarks:

name                       old time/op    new time/op    delta
MsgLength-12                  349ns ± 4%     387ns ± 2%   +10.92%  (p=0.000 n=9+9)
MsgLengthNoCompression-12    28.0ns ± 1%    63.3ns ± 2%  +125.91%  (p=0.000 n=10+10)
MsgLengthPack-12             1.10µs ± 8%    1.12µs ± 4%      ~     (p=0.138 n=10+10)
MsgLengthMassive-12          26.1µs ± 2%    27.3µs ± 6%    +4.85%  (p=0.000 n=9+10)
MsgLengthOnlyQuestion-12     10.0ns ± 3%    17.1ns ± 2%   +72.14%  (p=0.000 n=10+9)
MsgLengthEscapedName-12      9.25ns ± 1%   96.08ns ± 1%  +938.58%  (p=0.000 n=9+10)
PackMsg-12                    957ns ± 1%    1015ns ± 1%    +6.10%  (p=0.000 n=10+9)
PackMsgOnlyQuestion-12        173ns ± 2%     182ns ± 2%    +5.08%  (p=0.000 n=9+10)

Fixes #841

@tmthrgd tmthrgd requested a review from miekg November 30, 2018 01:04
@codecov-io
Copy link

codecov-io commented Nov 30, 2018

Codecov Report

Merging #850 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
+ Coverage    57.9%   57.95%   +0.05%     
==========================================
  Files          42       42              
  Lines       10661    10675      +14     
==========================================
+ Hits         6173     6187      +14     
  Misses       3399     3399              
  Partials     1089     1089
Impacted Files Coverage Δ
msg.go 77.98% <100%> (+0.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 778aa4f...6d76705. Read the comment docs.

@miekg miekg merged commit 8d24af5 into miekg:master Nov 30, 2018
@tmthrgd tmthrgd deleted the escaped-compress-length branch November 30, 2018 09:31
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