Skip to content

[improve][broker] Reduce object allocation when iterate on LongPairRangeSet #18356

Closed

Description

@lifepuzzlefun

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

according to #18240

when iterate on LongPairRangeSet call forEach will:

  1. convert long pair into Range object.
  2. and then the Range object is passed to LongPairConsumer<? extends T> consumer which is PostitionImpl::new.

but for the case ManagedCursorImpl.buildIndividualDeletedMessageRanges and ConcurrentOpenLongPairRangeSet.size
we can get the answer by just perform on the raw (long, long) format. the object creation can be avoided.

Solution

No response

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. lifepuzzlefun commented on Nov 6, 2022

    @lifepuzzlefun
    ContributorAuthor

    the memory alloction framegraph show the conclusion

    1. ConcurrentOpenLongPairRangeSet.size
      image

    2. ManagedCursorImpl.buildIndividualDeletedMessageRanges

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions