下表比较了Gruvi针对asyncio,gevent和eventlet的一些设计决策和功能。
http://eb2dec84.wiz03.com/share/s/3HbuO40KyQdv2DUiir2nBZ9q1nxiAN3XUAw12bf0ff24rYBI
特征 | Gruvi | Asyncio | Gevent | Eventlet |
---|---|---|---|---|
IO library(依赖包) | libuv | stdlib | libev | stdlib / libevent |
IO抽象传输/协议 | Transports/ProtocolsGreen | sockets | Green sockets | reen sockets |
Threading | fibers | yield from | greenlet | greenlet |
Resolver(解析器) | threadpool | threadpool | threadpool / c-ares | blocking/dnspython |
Python: 2.x | YES (2.7) | YES (2.6+, viaTrollius) | YES | YES |
Python: 3.x | YES (3.3+) | YES | NO | NO |
Python: PyPy | NO | NO | YES | YES |
Platform: Linux | FAST(快速) | FAST | FAST | FAST |
Platform: Mac OSX | FAST | FAST | FAST | FAST |
Platform: Windows | FAST (IOCP) | FAST (IOCP) | SLOW (select) | SLOW (select) |
SSL: Posix | FAST | FAST | FAST | FAST |
SSL: Windows | FAST (IOCP) | FAST (IOCP 3.5+) | SLOW (select) | SLOW (select) |
SSL: Contexts | YES (also Py2.7) | YES (also Py2.6+) | NO | NO |
HTTP | FAST (via http-parser) | NO (external) | SLOW (stdlib) | SLOW (stdlib) |
Monkey Patching(是否使用猴子补丁) | NO | NO | YES | YES |
# 测试代码块
import time
time_tuple = time.localtime(time.time())
print time_tuple # time.struct_time(tm_year=2019, tm_mon=1, tm_mday=30, tm_hour=11, tm_min=29, tm_sec=33, tm_wday=2, tm_yday=30, tm_isdst=0)
网友评论