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

InstantCoder: stop boxing Longs unnecessarily #3270

Closed
wants to merge 1 commit into from

Conversation

dhalperi
Copy link
Contributor

In encode, and similar in decode, the existing path goes
Instant->long (inside of converter)
long->Long (returned from converter)
Long->long (inside of LongCoder).

This is a relatively small improvement, but as we encode timestamps
for every single element, this is likely to make a difference in
lightweight stages of pipelines.

R: @lukecwik @bjchambers

}

/** A primitive version of {@link #encode(Long, OutputStream)}. */
public void encodeLong(long value, OutputStream outStream) throws IOException, CoderException {
Copy link
Member

@lukecwik lukecwik May 31, 2017

Choose a reason for hiding this comment

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

Instead of making this and decodeLong public, why not just copy this code into InstantCoder and stop coupling the two coders together?

In encode, and similar in decode, the existing path goes
  Instant->long (inside of converter)
  long->Long (returned from converter)
  Long->long (inside of LongCoder).

This is a relatively small improvement, but as we encode timestamps
for every single element, this is likely to make a difference in
lightweight stages of pipelines.
@dhalperi
Copy link
Contributor Author

PTAL

Copy link
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

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

LGTM

@asfgit asfgit closed this in dc70383 May 31, 2017
@asfbot
Copy link

asfbot commented May 31, 2017

Build finished.
--none--

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