[core][2/N] Avoid unnecessary deserialization/serialization of ObjectId#53574
Conversation
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
|
|
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 {
|
oh wow i didn't expect this to have such a big impact, what does stage_2 time actually measure |
It passes 20 ( |
| !message_->args(arg_index).is_inlined(); | ||
| } | ||
|
|
||
| ObjectID TaskSpecification::ArgId(size_t arg_index) const { |

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.