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

CountedBitSet doesn't need to extend BitSet. #28239

Merged
merged 1 commit into from
Jan 22, 2018

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Jan 16, 2018

Changing it makes sure that calls to BitSet methods are always bimorphic, which
Java can handle more efficiently.

Changing it makes sure that calls to BitSet methods are always bimorphic, which
Java can handle more efficiently.
@jasontedor
Copy link
Member

jasontedor commented Jan 16, 2018

I think this is maybe guided by a misunderstanding of call-site dispatching in the JVM? The method caches are per call-site, so if a call-site only ever sees one (monomorphic) or two (biomorphic) runtime types then the JVM will use optimized inline caches for method dispatching at that call site. If another call site sees a different collection of runtime types for the same virtual method dispatch, a different inline cache is used, and amongst these call sites there could be more than two runtime types yet the JVM could still used optimized inline caches. It is only when a call site sees more than two (megamorphic) that the call site is not optimized, yet still it does not impact other call sites.

@jpountz
Copy link
Contributor Author

jpountz commented Jan 16, 2018

Indeed, I don't expect improvements from this patch (hence the non-issue). My goal was to make the compiler ensure it.

@dnhatn
Copy link
Member

dnhatn commented Jan 17, 2018

@bleskes What do you think? I remember that you preferred to make CountedBitSet as a drop-in replacement for BitSet.

@bleskes
Copy link
Contributor

bleskes commented Jan 17, 2018

I originally thought we'd benefit more from this being a BitSet we can pass around. Given how limited this ended up being, I don't really mind either way. It's enough for me that @jpountz wants to do it :)

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @jpountz.

@jpountz jpountz merged commit 8d195c8 into elastic:master Jan 22, 2018
@jpountz
Copy link
Contributor Author

jpountz commented Jan 22, 2018

Thanks @dnhatn

@jpountz jpountz deleted the fix/CountedBitSet branch January 22, 2018 11:43
jasontedor added a commit that referenced this pull request Jan 22, 2018
* master:
  Trim down usages of `ShardOperationFailedException` interface (#28312)
  Do not return all indices if a specific alias is requested via get aliases api.
  [Test] Lower bwc version for rank-eval rest tests
  CountedBitSet doesn't need to extend BitSet. (#28239)
  Calculate sum in Kahan summation algorithm in aggregations (#27807) (#27848)
  Remove the `update_all_types` option. (#28288)
  Add information when master node left to DiscoveryNodes' shortSummary() (#28197)
  Provide explanation of dangling indices, fixes #26008 (#26999)
jasontedor added a commit that referenced this pull request Jan 22, 2018
* 6.x:
  Trim down usages of `ShardOperationFailedException` interface (#28312)
  Clean up commits when global checkpoint advanced (#28140)
  Do not return all indices if a specific alias is requested via get aliases api.
  CountedBitSet doesn't need to extend BitSet. (#28239)
  Calculate sum in Kahan summation algorithm in aggregations (#27807) (#27848)
jasontedor added a commit to matarrese/elasticsearch that referenced this pull request Jan 24, 2018
* master: (94 commits)
  Completely remove Painless Type from AnalyzerCaster in favor of Java Class. (elastic#28329)
  Fix spelling error
  Reindex: Wait for deletion in test
  Reindex: log more on rare test failure
  Ensure we protect Collections obtained from scripts from self-referencing (elastic#28335)
  [Docs] Fix asciidoc style in composite agg docs
  Adds the ability to specify a format on composite date_histogram source (elastic#28310)
  Provide a better error message for the case when all shards failed (elastic#28333)
  [Test] Re-Add integer_range and date_range field types for query builder tests (elastic#28171)
  Added Put Mapping API to high-level Rest client (elastic#27869)
  Revert change that does not return all indices if a specific alias is requested via get alias api. (elastic#28294)
  Painless: Replace Painless Type with Java Class during Casts (elastic#27847)
  Notify affixMap settings when any under the registered prefix matches (elastic#28317)
  Trim down usages of `ShardOperationFailedException` interface (elastic#28312)
  Do not return all indices if a specific alias is requested via get aliases api.
  [Test] Lower bwc version for rank-eval rest tests
  CountedBitSet doesn't need to extend BitSet. (elastic#28239)
  Calculate sum in Kahan summation algorithm in aggregations (elastic#27807) (elastic#27848)
  Remove the `update_all_types` option. (elastic#28288)
  Add information when master node left to DiscoveryNodes' shortSummary() (elastic#28197)
  ...
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
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.

5 participants