-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SharedCache] Optimize parsing of slide info
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. This collection of optimizations cuts the time spent applying the slide roughly in half (125ms to 65ms on a macOS shared cache). The individual changes are: 1. Avoid building the rewrites vector unless `SLIDEINFO_DEBUG_TAGS` is enabled. Building the vector was the single most expensive operation in the function. 2. 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 significant given the small size of the read and number of times it is called. 3. Update `ParseAndApplySlideInfoForFile` to take a pointer rather than a `std::shared_ptr`. This method doesn't need to manipulate the ownership of the object so the `shared_ptr` is unnecessary.
- Loading branch information
Showing
2 changed files
with
23 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters