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

interleave::get is "expensive" #1551

Open
yarikoptic opened this issue Dec 11, 2024 · 1 comment
Open

interleave::get is "expensive" #1551

yarikoptic opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels
performance Improve performance of an existing feature

Comments

@yarikoptic
Copy link
Member

Part of troubleshooting of

running a straightforward download

rm -rf sub-*; DANDI_DEVEL_AGGRESSIVE_RETRY=1 dandi --log-level=INFO download -e refresh -J 1:1 https://api.dandiarchive.org/api/assets/f0da6521-b9c7-4fa5-9405-c48527aebe90/download/

which is a single file/thread download leads to dandi CLI being 10-20% CPU and py-spy showing

image

so sampling profiler finds itself most often in get (interleave/__init__.py). There are multiple gets in that file but this particular Interleaver.get https://github.com/jwodder/interleave/blob/master/src/interleave/__init__.py#L348 is the primary suspect due to internal while True loop.

@jwodder could you please see if code there potentially be made more efficient?

@yarikoptic yarikoptic added the performance Improve performance of an existing feature label Dec 11, 2024
@jwodder
Copy link
Member

jwodder commented Dec 11, 2024

@yarikoptic I can't think of a way to make it more efficient. Note that the while True loop should largely be spending its time waiting for queue.SimpleQueue.get().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Improve performance of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants