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

Added an ImapToken cache to try and reduce ImapToken allocations #1630

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on May 18, 2024

  1. Configuration menu
    Copy the full SHA
    29a99cf View commit details
    Browse the repository at this point in the history
  2. Modified the ImapToken caching logic to include qstring tokens

    Also reduced memory allocations in ImapTokenCache.AddOrGet()
    jstedfast committed May 18, 2024
    Configuration menu
    Copy the full SHA
    ca0309e View commit details
    Browse the repository at this point in the history
  3. Updated ImapStream, ImapEngine, and ImapCommand to reuse ByteArrayBui…

    …lders
    
    This drastically reduces the number of allocations made when tokenizing
    IMAP responses.
    
    ImapCommand's usage was not really a major issue, but since ImapEngine.ReadLine/Async()
    needed a reusable ByteArrayBuilder anyway, might as well share that with ImapCommand.
    jstedfast committed May 18, 2024
    Configuration menu
    Copy the full SHA
    c4fca35 View commit details
    Browse the repository at this point in the history
  4. Modified ByteArrayBuilder.Clear() to downsize its buffer if it has gr…

    …own too large
    
    One potential problem with reusing ByteArrayBuilders is that, because they can
    grow for some abnormally long tokens/lines/commands/etc, those oversized buffers
    will remain referenced by the ImapStream/ImapEngine until they are disposed which
    could be the life of the program.
    
    If we oportunistically scale back the size of the buffers when they are Clear()'d,
    then we can periodically reduce memory usage and allow those larger buffers to be
    used elsewhere.
    jstedfast committed May 18, 2024
    Configuration menu
    Copy the full SHA
    aeb0135 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3f08526 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b0838f4 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    71319f6 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d82f45c View commit details
    Browse the repository at this point in the history