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

spec: use int64, allow counter-flow messages #71

Merged
merged 4 commits into from
Mar 5, 2019
Merged

Conversation

bassosimone
Copy link
Contributor

@bassosimone bassosimone commented Mar 4, 2019

It makes sense to use float64 where the measurement unit is
a floating, but using it when we're sending integer quantities
is actually a bit surprising.

While it's true that float64 is native to the i386 platform
and int64 it's not, I don't even know whether int64 is slower
than float64 and, even if that was the case, it would probably
be weird anyway to use float64 rather than int64.

Another reason why I was using float64 is that I didn't know
how to extact int64s from C code. But C code is gone in the
previous commit. Conclusion: let's use int64 instead.

Now, why int64 and not uint64? The different is subtle. We
know that in many cases golang is using signed integers also
for sizes, so that is not so surprising in golang. In Java there
is no unsigned, so in theory I could say I am doing this for
the sake of good old Java. The reality is that JSON cannot really
serialize numbers larger than 2^53 as integers, therefore the
distinction betwwn int64 and uint64 here is academic. Thus,
I have picked the most natural feat in golang.

(Should I check for overflow? In theory. In practice I think we
are good for quite some years without checking for overflow of
int64 variables. Also, in the server side there are checks for
overflow of int64, but not of int53. In the client side I
think we should not care, since that is a minimal client.)


In addition to the above, there is also a17f14f that reallows
counter-flow messages. Will make upload better.


This change is Reviewable

It makes sense to use float64 where the measurement unit is
a floating, but using it when we're sending integer quantities
is actually a bit surprising.

While it's true that `float64` is native to the i386 platform
and `int64` it's not, I don't even know whether `int64` is slower
than `float64` and, even if that was the case, it would probably
be weird anyway to use `float64` rather than `int64`.

Another reason why I was using `float64` is that I didn't know
how to extact `int64`s from C code. But C code is gone in the
previous commit. Conclusion: let's use `int64` instead.

Now, why `int64` and not `uint64`? The different is subtle. We
know that in many cases golang is using signed integers also
for sizes, so that is not so surprising in golang. In Java there
is no unsigned, so in theory I could say I am doing this for
the sake of good old Java. The reality is that JSON cannot really
serialize numbers larger than 2^53 as integers, therefore the
distinction betwwn `int64` and `uint64` here is academic. Thus,
I have picked the most natural feat in golang.

(Should I check for overflow? In theory. In practice I think we
are good for quite some years without checking for overflow of
`int64` variables. Also, in the server side there are checks for
overflow of `int64`, but not of `int53`. In the client side I
think we should not care, since that is a minimal client.)
@bassosimone bassosimone self-assigned this Mar 4, 2019
@bassosimone bassosimone requested a review from pboothe March 4, 2019 20:39
@coveralls
Copy link
Collaborator

coveralls commented Mar 4, 2019

Pull Request Test Coverage Report for Build 446

  • 0 of 6 (0.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 58.844%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ndt7/client.go 0 2 0.0%
bbr/bbr_linux.go 0 4 0.0%
Totals Coverage Status
Change from base Build 442: -0.2%
Covered Lines: 692
Relevant Lines: 1176

💛 - Coveralls

Copy link
Contributor

@pboothe pboothe left a comment

Choose a reason for hiding this comment

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

So, I like this in theory. But Javascript has no integers, so JS clients will convert this to float64. Is that okay?

spec/ndt7-protocol.md Outdated Show resolved Hide resolved
@bassosimone
Copy link
Contributor Author

So, I like this in theory. But Javascript has no integers, so JS clients will convert this to float64. Is that okay?

It is okay. I'll clarify that, thanks!

Also, we don't have UDP overhead that we know of.
As mentioned in the spec, this is quite an academic concern for
the moment and most likely in the future. However, clarify we have
thought about this issue, we currently consider it relevant for
pedantic implementations only, and recommend pedantic code to
make sure the int53 boundary is correctly respected.

We may change our mind in the future. (The most likely course of
action is that we'll specify what a pedantic implementation is
supposed to do in such case. For now it doesn't matter.)
Do not require these messages to be sent. Yet, require a party to be
prepared to receive these messages.

The reason why I'm doing this now is to take advantage of the
recent bump in the specification version.
@bassosimone bassosimone changed the title Do not use float64 when int64 would suffice spec: use int64, allow counter-flow messages Mar 5, 2019
Copy link
Contributor

@pboothe pboothe left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pboothe)

@bassosimone bassosimone merged commit 47605b8 into master Mar 5, 2019
@bassosimone bassosimone deleted the feature/nofloat branch March 5, 2019 18:59
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

3 participants