Repository navigation
[core][2/N] Avoid unnecessary deserialization/serialization of ObjectId - #53574
Merged
edoakes merged 2 commits intoJun 9, 2025
Merged
Conversation
Signed-off-by: Kai-Hsun Chen <[email protected]>
Member
Author
|
|
kevin85421
marked this pull request as ready for review
June 5, 2025 06:53
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new method to fetch raw ObjectID binaries directly and updates call sites to avoid redundant ObjectID serialization/deserialization.
- Add
GetArgRawObjectIdtoTaskSpecificationfor efficient access to the argument’s binary ID - Update
core_worker.ccandtask_executor.ccto use the new raw ID method instead ofObjectID::Binary() - Include documentation and method signature changes in
task_spec.h/.cc
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/ray/core_worker/core_worker.cc | Replaced ArgId(i).Binary() with GetArgRawObjectId(i) |
| src/ray/common/task/task_spec.h | Added documentation and declaration for GetArgRawObjectId |
| src/ray/common/task/task_spec.cc | Implemented GetArgRawObjectId |
| cpp/src/ray/runtime/task/task_executor.cc | Replaced ArgId(i).Binary() with GetArgRawObjectId(i) |
Comments suppressed due to low confidence (3)
src/ray/common/task/task_spec.h:344
- Clarify in the doc comment that this returns the binary string matching
ObjectID::Binary(), so readers know it’s the same format.
/// Get the raw object ID of the argument at the given index.
src/ray/common/task/task_spec.h:348
- [nitpick] Consider renaming this method to something like
ArgIdBinaryorGetArgIdStringto clearly distinguish it fromArgId, which returns anObjectID.
std::string GetArgRawObjectId(size_t arg_index) const;
src/ray/common/task/task_spec.cc:293
- No unit tests cover this new method. Adding tests for both reference and inlined argument cases will ensure
GetArgRawObjectIdbehaves as expected.
std::string TaskSpecification::GetArgRawObjectId(size_t arg_index) const {
edoakes
reviewed
Jun 5, 2025
Contributor
|
oh wow i didn't expect this to have such a big impact, what does stage_2 time actually measure |
Signed-off-by: Kai-Hsun Chen <[email protected]>
Member
Author
It passes 20 ( |
kevin85421
commented
Jun 9, 2025
| !message_->args(arg_index).is_inlined(); | ||
| } | ||
|
|
||
| ObjectID TaskSpecification::ArgId(size_t arg_index) const { |
8 tasks
edoakes
approved these changes
Jun 9, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why are these changes needed?
ArgId(i)deserializes binary toObjectId.Binary()serializesObjectIdto binary.speedup ~17% (#53574 (comment))
ArgIdtoGetArgObjectIdGetArgObjectIdBinaryRelated issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.