Skip to content

Conversation

@xinyuangui2
Copy link
Contributor

@xinyuangui2 xinyuangui2 commented Nov 18, 2025

The GIL makes checking self._serialize_cache is not None atomic, so we don't need lock.

The GIL makes checking s`elf._serialize_cache is not None` atomic, so we don't need lock.

Signed-off-by: Xinyuan <[email protected]>
@xinyuangui2 xinyuangui2 requested a review from a team as a code owner November 18, 2025 00:48
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valid performance optimization to __arrow_ext_serialize__ by adding a check for a cached result before acquiring a lock. This is a standard double-checked locking pattern, which is safe in this context due to Python's GIL ensuring atomic reads for the cache check. The change effectively reduces lock contention when the cache is populated. The implementation is correct and I have no concerns.

@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Nov 18, 2025
@raulchen raulchen enabled auto-merge (squash) November 18, 2025 16:24
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Nov 18, 2025
@raulchen raulchen added data Ray Data-related issues and removed core Issues that should be addressed in Ray Core labels Nov 18, 2025
@raulchen raulchen merged commit f6c416a into ray-project:master Nov 18, 2025
7 checks passed
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
The GIL makes checking `self._serialize_cache is not None` atomic, so we
don't need lock.

Signed-off-by: Xinyuan <[email protected]>
Signed-off-by: Aydin Abiar <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Nov 21, 2025
The GIL makes checking `self._serialize_cache is not None` atomic, so we
don't need lock.

Signed-off-by: Xinyuan <[email protected]>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
The GIL makes checking `self._serialize_cache is not None` atomic, so we
don't need lock.

Signed-off-by: Xinyuan <[email protected]>
Signed-off-by: YK <[email protected]>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
The GIL makes checking `self._serialize_cache is not None` atomic, so we
don't need lock.

Signed-off-by: Xinyuan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants