Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
1st1
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
35 ms
·
391.
▲
Typed Python: new Mypy release
(mypy-lang.blogspot.com)
156 points
by
1st1
10y ago
|
46 comments
392.
▲
by
1st1
10y ago
asyncio already allows that. uvloop, as of now, only runs on *nix; but I hope we'll have Windows supported soon too.
393.
▲
by
1st1
10y ago
Most of nodejs internals are in C++ on top of libuv. Only a thin layer of JS interfaces wrap that. Python is also a dynamic, GCed language. uvloop is built with Cython, which uses the Python object model (and all of its overhead!), and CPy
394.
▲
by
1st1
10y ago
Have you benchmarked it?
395.
▲
by
1st1
10y ago
> Once PyPy3 is available, will this work with it? We'll find a way!
396.
▲
by
1st1
10y ago
Feel free to make a PR to https://github.com/MagicStack/vmbench !
397.
▲
by
1st1
10y ago
Keep in mind that the HTTP server in the benchmarks actually uses the httptools parser, which is a full-blown HTTP parser. A lot of heavy-lifting is done by the parser. I plan to add a complete HTTP protocol implementation to httptools, but
398.
▲
by
1st1
10y ago
I guess I look at the benchmarks in a bit different light. These benchmarks are primarily comparing event loops and their performance. TCP benchmark is very fair, HTTP - maybe not so much. The point is to show that you can write super fas
399.
▲
by
1st1
10y ago
Maybe. But I think its parser is better to be replaced with the httptools one.
400.
▲
by
1st1
10y ago
There is nothing misleading about the benchmarks. It is explicitly said that ALL frameworks were benchmarked in single-process and single-thread modes. Yes, in production you should run your nodejs app in cluster, your Python apps in a mult
401.
▲
by
1st1
10y ago
> but will probably do more justice to Node.js vs Python. How so? Clustering for node just makes it run in several OS processes. You can (and should) do the same for Python code, it's easy.
402.
▲
by
1st1
10y ago
Thanks!
403.
▲
by
1st1
10y ago
> Asyncio is pretty fast, but as soon as you write any Python logic, request per second will drop significantly. Sure, but it really depends on how complex your Python code is. > I'm surprise uvloop is faster than node.js since l
404.
▲
by
1st1
10y ago
AFAIK, StreamServer should actually affect benchmark in a positive way. In gevent case, StreamServer isn't about high-level abstractions, it's about making sure that client sockets always have a READ flag in the IO multiplexor (e
405.
▲
by
1st1
10y ago
I'm actually thinking about writing such a framework :) I'll call it "spin".
406.
▲
by
1st1
10y ago
Everything is in the blog post: https://github.com/MagicStack/vmbench/tree/master/servers
407.
▲
by
1st1
10y ago
Streams implementation is a pretty big chunk of Python code, that manages flow control, buffering, and integration with coroutines. And you don't always need all that stuff when you're writing a protocol, since you can implement t
408.
▲
by
1st1
10y ago
It depends. Maybe you aren't closing the sockets properly (shutdown + close). Or maybe, because of how TCP works, the sockets are stuck in timeouts and don't really close for a long period of time. If its something like that, then
409.
▲
by
1st1
10y ago
Not really practical. uvloop is designed to work in tandem with asyncio, which is a Python 3-only module. asyncio, in turn, requires 'yield from' support, something that Python 2 doesn't have.
410.
▲
by
1st1
10y ago
1) I don't know :( I've answered a similar question in this thread with a couple of guesses. 2) No, they have a different architecture. Although I heard that there is a project to integrate asyncio into django to get websockets
411.
▲
by
1st1
10y ago
> Building on to this, how does it compare to raw libuv in c? Building something in C is very hard. uvloop wraps all libuv primitives in Python objects which know how to manage the memory safely (i.e. not to "free" something b
412.
▲
by
1st1
10y ago
> [..] Would be great to see how uvloop compares there [..] Yep, I'm curious to see what will happen there. Do you have any suggestions on what tool to use to generate the load? > [..] someday when PyPy supports Python 3.5, there
413.
▲
by
1st1
10y ago
The HTTP benchmarks were actually run under concurrency level of 300. I've just updated the post with extra details. See also the full report of HTTP benchmark [1] [1] http://magic.io/blog/uvloop-blazing-fast-pyth
414.
▲
by
1st1
10y ago
There are benchmarks of curio in the blog post, FWIW.
415.
▲
by
1st1
10y ago
> These benchmarks seem to only use 10 clients concurrently, max. That's ridiculously low. I've just update the post with more details on HTTP benchmarks and attached the correct full-results file [1]. The concurrency level fo
416.
▲
by
1st1
10y ago
Two things I'd check first: 1. The benchmarks make servers generate a huge number of objects, so maybe, the GC is under too much pressure. 2. Another possibility is that the v8 JIT can't optimize some JS code in nodejs, or does a
417.
▲
by
1st1
10y ago
For benchmarks we have a separate project on the GH: [1] -- you can run the benchmarks on a Linux box pretty easily. Here's an example output: [2] [1] https://github.com/MagicStack/vmbench [2] http://m
418.
▲
by
1st1
10y ago
Wherever you use asyncio, it should be safe to just start using uvloop (once we graduate it from beta). uvloop shouldn't behave any differently, I've paid special attention to make sure it works exactly the same way as asyncio (do
419.
▲
by
1st1
10y ago
I'd say it's not yet ready for production. The test coverage is fairly decent, though, so I hope we'll make a stable release soon. That said, uvloop should be fully compatible with asyncio. All APIs should be ready, so you c
420.
▲
by
1st1
10y ago
I'm the dev behind uvloop. AMA.
More ›