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

Moving to asyncio #771

Open
dizcza opened this issue Nov 25, 2020 · 2 comments
Open

Moving to asyncio #771

dizcza opened this issue Nov 25, 2020 · 2 comments

Comments

@dizcza
Copy link
Contributor

dizcza commented Nov 25, 2020

Problem
Visdom appeals to me because of the iterative send updates to a server. However, I'm always frustrated to see that visdom get and post requests are 10 times (!) slower than my analysis payload script. This is because visdom uses requests under the hood, which is sequential by design.

Describe the solution you'd like
Switching to asyncio coroutines. In particular, using asyncio.create_task. The await mechanism needs to be discussed (when to await? - Either return coroutines to the users to let them handle awaits or make a public function await in the visdom client.) One could also add async flag in Visdom.__init__ which can be False by default.

Describe alternatives you've considered
uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood.

Additional context
Take a look at visdom.scatter profile botelnecks:

[time spent]   [line]
40.9 %         exists = self.win_exists(win, env)
54.0 %         return self._send(data_to_send, endpoint=endpoint)

Let me know if you're interested in switching to asyncio.

Best,
Danylo

@JackUrb
Copy link
Contributor

JackUrb commented Nov 30, 2020

I'm definitely a fan of asyncio, and would be interested to see Visdom updated to be compatible with coroutines. I worry a bit that we'll lose more backwards compatibility for those who don't have it though, but ultimately think it's the right overall direction.

@dizcza
Copy link
Contributor Author

dizcza commented Dec 1, 2020

I'll wait for the #675 first, maybe fix other code style issues, and then consider adding asyncio because adding such an advanced API as asyncio makes sense when the code is relatively clean.
Maybe others are interested in doing this.

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

No branches or pull requests

4 participants