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

[SharedCache] Optimize parsing and applying of slide info #6321

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

bdash
Copy link
Contributor

@bdash bdash commented Jan 15, 2025

Slide info is parsed and applied on the main thread, below the SharedCache constructor, when a shared cache is opened. Time spent applying the slide is time that the main thread is blocked.

These changes eliminate some unnecessary overhead so what work remains is dominated by kernel work (paging in data, copying pages when the first modification is made).

The changes are:

  1. Read slide pointers via ReadULong rather than the variable-length Read method. The compiler isn't able to eliminate the call to memcpy in the variable-length Read function, and the function call overhead is noticeable given the small size of the read and number of times it is called.
  2. Remove the file member from MappingInfo. Slide info is applied for a single file at a time so there's no reason to track the file it belongs to. This removes unnecesssary reference counting on the std::shared_ptr that holds the MMappedFileAccessor.

@plafosse plafosse added this to the Gallifrey milestone Feb 4, 2025
Slide info is parsed and applied on the main thread, below the
`SharedCache` constructor, when a shared cache is opened. Time spent
applying the slide is time that the main thread is blocked.

These changes eliminate some unnecessary overhead so what work remains
is dominated by kernel work (paging in data, copying pages when the
first modification is made).

The changes are:
1. Read slide pointers via `ReadULong` rather than the variable-length
   `Read` method. The compiler isn't able to eliminate the call to
   `memcpy` in the variable-length `Read` function, and the function
   call overhead is noticeable given the small size of the read and
   number of times it is called.
2. Remove the file member from `MappingInfo`. Slide info is applied for
   a single file at a time so there's no reason to track the file it
   belongs to. This removes unnecesssary reference counting on the
   `std::shared_ptr` that holds the `MMappedFileAccessor`.
@bdash bdash force-pushed the dsc-optimize-slide-info-parsing branch from a554405 to aa22af9 Compare February 13, 2025 18:29
@bdash
Copy link
Contributor Author

bdash commented Feb 13, 2025

Updated after 27eb30d removed use of the rewrites vector as the earlier version of this change did.

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