Python 3.6b2 will have C implemented Future

104 views
Skip to first unread message

Naoki INADA

unread,
Oct 9, 2016, 2:06:04 AM10/9/16
to python-tulip
Hi.

I've just pushed C implementation of asyncio.Future [1].
It will be included in Python 3.6b2.

It may have rough edge.  But I hope it will be battle tested
before Python 3.6.0.
Please help us by running your tests on Python 3.6b2, and
report issues you found.
If you have asyncio based project, and it uses Travis-CI,
please add "nightly" to your .travis.cnf [2].

Feedback about performance difference is also welcome.

Thanks,

Nickolai Novik

unread,
Oct 9, 2016, 9:19:38 AM10/9/16
to Naoki INADA, python-tulip
Hi
At aio-libs  (https://github.com/aio-libs/) projects: aiosmptpd, aiomysql, aiorwlock, aiohttp_sessions, aiohttp_security, aiohttp_debugtoolbar, aiohttp_admin, aiohttp_mako use "nightly" python version on Travis-CI. So far all builds are green. Hopefully in nearest future we will be able to test more projects with nightly.

Ludovic Gasc

unread,
Oct 10, 2016, 7:13:45 PM10/10/16
to Naoki INADA, python-tulip
Hi Naoki,

Thanks a lot for that.
FYI, we'll do a sprint code during PyCON-FR to upgrade AsyncIO test suite in TechEmpower Benchmarks, to include new interesting efficiency improvements from community (uvloop, asyncpg...).

We'll take the opportunity to test also with Python 3.6b2.

Maybe you might be interested in this issue, because it can be apply to all other Python frameworks, it's about JSON parsers: https://github.com/Eyepea/FrameworkBenchmarks/issues/4
Be my guest if you are interested in to do something.

BTW, if somebody's else has a new extra tip to improve efficiency, don't hesitate to drop me an e-mail or open an issue.

Have a nice week.

--
Ludovic Gasc (GMLudo)

INADA Naoki

unread,
Oct 11, 2016, 3:55:12 AM10/11/16
to python-tulip
> If you have asyncio based project, and it uses Travis-CI,
> please add "nightly" to your .travis.cnf [2].
>
> [2]
> https://docs.travis-ci.com/user/languages/python/#Choosing-Python-versions-to-test-against

Travis changed the "nightly" version to 3.7
Now "3.6-dev" is for Python 3.6beta (Still 3.6b1, it may be upgraded soon).

--
INADA Naoki <songof...@gmail.com>

Ben Darnell

unread,
Oct 13, 2016, 1:25:33 AM10/13/16
to INADA Naoki, python-tulip, asyn...@python.org
[+asyn...@python.org, which is the new home for these kinds of discussions]

Tornado's tests are now failing on nightly with "TypeError: can't send non-None value to a FutureIter":

INADA Naoki

unread,
Oct 13, 2016, 1:37:59 AM10/13/16
to Ben Darnell, python-tulip, asyn...@python.org
Thanks, Ben.

Both are very helpful information!
--
INADA Naoki <songof...@gmail.com>

Luca Sbardella

unread,
Nov 18, 2016, 5:42:53 PM11/18/16
to INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org
Pulsar's tests are now run against 3.6-dev and all passing.
Nice!
Getting used to the C Future ;-)

Luca Sbardella

unread,
Nov 18, 2016, 5:53:52 PM11/18/16
to INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org
But tests taking 1.48 longer to run on average!
Anything I should know about 3.6 and performance?

Yury Selivanov

unread,
Nov 18, 2016, 6:02:56 PM11/18/16
to Luca Sbardella, INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org

> On Nov 18, 2016, at 5:53 PM, Luca Sbardella <luca.sb...@gmail.com> wrote:
>
> But tests taking 1.48 longer to run on average!
> Anything I should know about 3.6 and performance?
>


That shouldn’t happen. Are you sure you aren’t running them in debug mode? Try to comment out imports of ‘_asyncio’ in futures.py and tasks.py and run benchmarks in 3.6 to compare Py Futures to C Futures.

Also, which Python 3.6 version are you using? Please try to build one from the repo, I’ve fixed a couple of bugs since 3.6b2.

Yury

Yury Selivanov

unread,
Nov 18, 2016, 6:09:46 PM11/18/16
to Luca Sbardella, INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org
Also, are you using uvloop or vanilla asyncio? Try to benchmark vanilla first. And if you have time, please try to test different combinations on vanilla asyncio:

Python 3.5 + vanilla asyncio
Python 3.6 + vanilla asyncio
Python 3.6 + Py Future + Py Task
Python 3.6 + Py Future + C Task
Python 3.6 + C Future + C Task
Python 3.6 + Py Future + Py Task

Yury

Luca Sbardella

unread,
Nov 18, 2016, 6:16:27 PM11/18/16
to Yury Selivanov, INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org


That shouldn’t happen.  Are you sure you aren’t running them in debug mode?  Try to comment out imports of ‘_asyncio’ in futures.py and tasks.py and run benchmarks in 3.6 to compare Py Futures to C Futures.

Also, which Python 3.6 version are you using?  Please try to build one from the repo, I’ve fixed a couple of bugs since 3.6b2.

Running 3.6-dev from travis, currently b4+.
No debug mode, that is an order of magnitude slower ;-)

Having said that, running another test suite, more asyncio centric, I get the 3.6-dev running at 68% speed v 3.5.2.
So it looks very good indeed!

Pulsar test suite is large and does not represent asyncio 1:1.
Sorry for confusion, I will investigate further




--

Yury Selivanov

unread,
Nov 18, 2016, 6:19:12 PM11/18/16
to Luca Sbardella, INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org

> On Nov 18, 2016, at 6:16 PM, Luca Sbardella <luca.sb...@gmail.com> wrote:
>
> Running 3.6-dev from travis, currently b4+.
> No debug mode, that is an order of magnitude slower ;-)

FWIW I found that I can’t really trust the build times on travis for measuring any kind of performance regressions. You don’t know how it’s compiled there, and more importantly, if Python 3.6 is compiled with the same settings as 3.5.

Yury

Luca Sbardella

unread,
Nov 19, 2016, 6:51:22 AM11/19/16
to Yury Selivanov, INADA Naoki, Ben Darnell, python-tulip, asyn...@python.org
On 18 November 2016 at 23:09, Yury Selivanov <yseli...@gmail.com> wrote:
Also, are you using uvloop or vanilla asyncio?  Try to benchmark vanilla first.  And if you have time, please try to test different combinations on vanilla asyncio:

Python 3.5 + vanilla asyncio
Python 3.6 + vanilla asyncio
Python 3.6 + Py Future + Py Task
Python 3.6 + Py Future + C Task
Python 3.6 + C Future + C Task
Python 3.6 + Py Future + Py Task

These are results of an asyncio-based benchmark - no sockets involved - highly nested coroutines
The --io uv flag indicates a run with uvloop.

py35 setup.py bench -a coroutine
TestCoroutine.test_coroutine: repeated 10(x1000) times, average 0.50100 secs, stdev 1.13 %

py35 setup.py bench -a coroutine --io uv
TestCoroutine.test_coroutine: repeated 10(x1000) times, average 0.08246 secs, stdev 3.87 %

py36 setup.py bench -a coroutine
TestCoroutine.test_coroutine: repeated 10(x1000) times, average 0.26563 secs, stdev 2.35 %

py36 setup.py bench -a coroutine --io uv
TestCoroutine.test_coroutine: repeated 10(x1000) times, average 0.06762 secs, stdev 5.43 %

I'll benchmark with sockets next
Reply all
Reply to author
Forward
0 new messages