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

[SPARK-13113][Core] Remove unnecessary bit operation when decoding page number #11002

Closed
wants to merge 1 commit into from

Conversation

viirya
Copy link
Member

@viirya viirya commented Feb 1, 2016

JIRA: https://issues.apache.org/jira/browse/SPARK-13113

As we shift bits right, looks like the bitwise AND operation is unnecessary.

@@ -312,7 +312,7 @@ public static long encodePageNumberAndOffset(int pageNumber, long offsetInPage)

@VisibleForTesting
public static int decodePageNumber(long pagePlusOffsetAddress) {
return (int) ((pagePlusOffsetAddress & MASK_LONG_UPPER_13_BITS) >>> OFFSET_BITS);
return (int) (pagePlusOffsetAddress >> OFFSET_BITS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we absolutely sure that the top bit is not used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it should be >>> not >>. I will update this.

@SparkQA
Copy link

SparkQA commented Feb 1, 2016

Test build #50486 has finished for PR 11002 at commit 7f1439b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Member Author

viirya commented Feb 1, 2016

retest this please.

@SparkQA
Copy link

SparkQA commented Feb 1, 2016

Test build #50489 has finished for PR 11002 at commit 4b846dd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya viirya changed the title [SPARK-12950][Core] Remove unnecessary bit operation when decoding page number [SPARK-13113][Core] Remove unnecessary bit operation when decoding page number Feb 1, 2016
@holdenk
Copy link
Contributor

holdenk commented Feb 1, 2016

This change looks good to me, maybe @JoshRosen who was the last to touch that line can take a look?

@srowen
Copy link
Member

srowen commented Feb 2, 2016

Seems OK, are there other redundant usages? The constant name including 13 seems overly specific too

@viirya
Copy link
Member Author

viirya commented Feb 2, 2016

I will check again. But yesterday I just found this.

@viirya
Copy link
Member Author

viirya commented Feb 3, 2016

Hmm, I just found this after another check.

@viirya
Copy link
Member Author

viirya commented Feb 3, 2016

cc @davies @JoshRosen

@viirya
Copy link
Member Author

viirya commented Feb 4, 2016

@davies Can you take a look if this is proper to merge? Thanks.

@davies
Copy link
Contributor

davies commented Feb 4, 2016

LGTM, merging this into master.

@asfgit asfgit closed this in d390871 Feb 4, 2016
@viirya viirya deleted the improve-decodepagenumber branch December 27, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants