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

adjust the lock location #111

Merged
merged 2 commits into from
Dec 27, 2023
Merged

adjust the lock location #111

merged 2 commits into from
Dec 27, 2023

Conversation

kaixuanliu
Copy link
Contributor

No description provided.

Signed-off-by: Liu,Kaixuan <[email protected]>
@LiSu
Copy link
Collaborator

LiSu commented Dec 27, 2023

lazy_init_sampler is called during every sampling operation, and it's too costly to directly acquire a lock before each call. An alternative fix could be to add an is_sampler_initialized flag and set it to true after initialization is complete. And we can use this flag to decide wether to acquire the lock or not.

Copy link
Collaborator

@LiSu LiSu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@LiSu LiSu merged commit fec4065 into alibaba:main Dec 27, 2023
1 of 3 checks passed
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.

2 participants