- 15 Apr, 2018 7 commits
-
-
Jason Madden authored
If those aren't available, use the old brute-force approach. This is closer to what CPython does in its C implementation, and is much faster. We don't have to worry about the async signal safe stuff the C code does because, guess what, we're running Python code here already anyway, so much of it could wind up doing something that's not actually safe anyway. Oh well. Since we depend on Python 3.4 and above now, we can rely on the CLOEXEC flag being set by default and not have to manually check everything. This speeds up 2.7 (close_fds defaults to *false* there, so the default case doesn't change): | Benchmark | 27_bench_subprocess | 27_bench_subprocess_dirfd | +---------------------------+---------------------+-------------------------------+ | spawn native no close_fds | 1.81 ms | 1.79 ms: 1.01x faster (-1%) | | spawn gevent no close_fds | 2.11 ms | 2.20 ms: 1.04x slower (+4%) | | spawn native close_fds | 31.0 ms | 30.2 ms: 1.03x faster (-3%) | | spawn gevent close_fds | 31.6 ms | 2.56 ms: 12.31x faster (-92%) | And it really speeds up 3.7 (close_fds defaults to *true* there, so the default case is much faster, and the non-default case is even better): | Benchmark | 37_bench_subprocess | 37_bench_subprocess_dirfd | +---------------------------+---------------------+-------------------------------+ | spawn native no close_fds | 1.34 ms | 1.27 ms: 1.06x faster (-6%) | | spawn gevent no close_fds | 117 ms | 3.05 ms: 38.27x faster (-97%) | | spawn native close_fds | 1.36 ms | 1.30 ms: 1.04x faster (-4%) | | spawn gevent close_fds | 32.5 ms | 3.34 ms: 9.75x faster (-90%) | Fixes #1172
-
Jason Madden authored
In response to #1172 The following numbers are for my machine on macOS 10.13.3 with MAXFD of 50000. Python 2.7: ..................... spawn native no close_fds: Mean +- std dev: 1.81 ms +- 0.04 ms ..................... spawn gevent no close_fds: Mean +- std dev: 2.11 ms +- 0.08 ms ..................... spawn native close_fds: Mean +- std dev: 31.0 ms +- 0.7 ms ..................... spawn gevent close_fds: Mean +- std dev: 31.6 ms +- 0.6 ms Notice that the times when close_fd=True (not the default on 2.7) are about the same. 2.7 uses the same Python loop we do to close all the fds. Now 3.7: ..................... spawn native no close_fds: Mean +- std dev: 1.34 ms +- 0.04 ms ..................... spawn gevent no close_fds: Mean +- std dev: 117 ms +- 2 ms ..................... spawn native close_fds: Mean +- std dev: 1.36 ms +- 0.03 ms ..................... spawn gevent close_fds: Mean +- std dev: 32.5 ms +- 0.4 ms Notice that gevent is *much* slower when we *don't* close the fds. This is because, starting in Python 3.4, close_fds defaults to true, and when it's false we have to check os.get_inheritable() for each fd before we close it. gevent performs the same as it did on Python 2.7 when closing fds, but the native implementation is much faster due to the C optimizations outlined in #1172---it turns out they apply to BSD and Apple platforms in addition to Linux, although they're not async safe. Now, the C code does the opposite for inheritable handles: it explicitly calls make_inheritable() for the ones it wants to keep and lets the OS close the others with CLOEXEC. We could probably do that too; the slow down for this case counts as a regression, I think.
-
Jason Madden authored
Move the API reference to its own (sectioned) page to clean up the main page. Break up the massive 'gevent' module page into more digestable parts and add more xrefs.
-
Jason Madden authored
-
Jason Madden authored
[skip ci]
-
Jason Madden authored
-
Jason Madden authored
Use environment markers to install CFFI on windows so the libuv backend can really be default
-
- 14 Apr, 2018 7 commits
-
-
Jason Madden authored
-
Jason Madden authored
-
Jason Madden authored
-
Jason Madden authored
-
Jason Madden authored
-
Jason Madden authored
Also try working around all the failed builds that pip 10 created: https://ci.appveyor.com/project/denik/gevent/build/1.0.1667/job/9jarsdxb6y0x2smd
-
Jason Madden authored
[skip ci]
-
- 13 Apr, 2018 3 commits
-
-
Jason Madden authored
-
Jason Madden authored
[skip ci]
-
Jason Madden authored
[skip ci]
-
- 10 Apr, 2018 1 commit
-
-
Jason Madden authored
Add extension points to gevent.monkey using events and setuptools entry points.
-
- 09 Apr, 2018 1 commit
-
-
Jason Madden authored
-
- 03 Apr, 2018 1 commit
-
-
Jason Madden authored
Fixes #1162. Refs #1158.
-
- 02 Apr, 2018 1 commit
-
-
Jason Madden authored
Make libuv the default backend on Windows. Fixes #1163.
-
- 31 Mar, 2018 3 commits
-
-
Jason Madden authored
-
Jason Madden authored
[skip ci]
-
Jason Madden authored
-
- 30 Mar, 2018 8 commits
-
-
Jason Madden authored
Update to libuv 1.19.2. Fixes #1129.
-
Jason Madden authored
-
Jason Madden authored
Use runpy.run_path for `python -m gevent.monkey`
-
Jason Madden authored
-
Jason Madden authored
-
Jason Madden authored
This lets us run packages and compiled files, as well as automatically taking care of all the import related globals like __file__ and __package__. Fixes #1157
-
Jason Madden authored
Update to 3.7.0b3
-
Jason Madden authored
-
- 29 Mar, 2018 1 commit
-
-
Jason Madden authored
-
- 27 Mar, 2018 3 commits
-
-
Jason Madden authored
The good news is that current master is about 10-15% faster for sendall than 1.2.2 was (e.g., 301ws vs 256ms in Python 3.6). udp sendto is roughly unaffected (within the margins, based on the native performance). Moving the chunking implementation of sendall to Cython doesn't show any improvements (so that's not a bottleneck, at least in these benchmarks). The "bad" news is that both UDP and (especially) sendall perform much worse than native (native does about 47ms for sendall). This is probably related to the fact that we're doing everything in one process and one thread, and it is CPU bound; the native process can use 150% CPU or so, but the gevent version cannot. So the comparison is not directly meaningful. [skip ci]
-
Jason Madden authored
Compile the important hub operations that use Waiters with Cython
-
Jason Madden authored
-
- 26 Mar, 2018 4 commits
-
-
Jason Madden authored
-
Jason Madden authored
Since we've come this far, might as well keep taking advantage of the effort... There are substantial improvements on the micro benchmarks for things that wait and switch: | Benchmark | 27_hub_master2 | 27_hub_cython5 | |---------------------|----------------|------------------------------| | multiple wait ready | 1.96 us | 1.10 us: 1.77x faster (-44%) | | wait ready | 1.47 us | 897 ns: 1.64x faster (-39%) | | cancel wait | 2.93 us | 1.81 us: 1.61x faster (-38%) | | switch | 2.33 us | 1.94 us: 1.20x faster (-17%) | | Benchmark | 36_hub_master2 | 36_hub_cython6 | |---------------------|----------------|------------------------------| | multiple wait ready | 1.28 us | 820 ns: 1.56x faster (-36%) | | wait ready | 939 ns | 722 ns: 1.30x faster (-23%) | | cancel wait | 1.76 us | 1.37 us: 1.29x faster (-23%) | | switch | 1.60 us | 1.35 us: 1.18x faster (-16%) |
-
Jason Madden authored
Compile gevent.queue and gevent.hub.waiter with Cython
-
Jason Madden authored
-