[Python-ideas] Type Hinting - Performance booster ?

Ludovic Gasc gmludo at gmail.com
Tue Dec 23 00:56:28 CET 2014


Thank you everybody for all pieces of information, very interesting.

I reply to everybody in the same e-mail:

1. For Python 3 usage: Where I work, we switched all new projects to Python
3 since almost one year. To be honest with you, it wasn't to be up-to-date,
but it was for a new feature not natively present in Python 2: AsyncIO. We
made a lot of Twisted (Telephony+WebSockets) and Django/Flask daemons
(WebServices), but I wanted to:
                 A. Create daemons
all-in-one (Telephony+WebSockets+WebServices) to share easier our business
logic for a same project.
                 B. Simplify architecture: Twisted and Django are very
complicated for our simple needs.
The side effects are:
                 A. Our productivity is better, we finish quicker our
projects for our clients, because we share more source code and the
architecture is simpler to handle.
                 B. The performances we have are better compare to the past.

Why I tell you that ? To give you a concrete example: if you want to
motivate Python developers from the battlefield to migrate to Python 3, you
need to add features/performances/... in Python 3. Not add all PyPI
libraries in CPython, but add features you can't add easily via a library,
like yield from, AsyncIO or Type Hinting.

On production systems, who cares is Python 2/3, Go, Erlang... ? Certainly
not clients and even management people. If you want that we use Python 3,
please give us arguments to "sell" the migration to Python 3 in the company.

2. For Python 3 deployment: I use Pythonz: https://github.com/saghul/pythonz
to quickly deploy a Python version on a new server with an Ansible recipe.
Certainly, some sys admins could be shocked by this behaviour because it's
forbidden in packaging religion, but who cares ? We lose less time to
deploy, it's more reproducible between dev environment and production, and
upgrades are very easy via Ansible.

3. About PyPy usage: I've made some benchmarks with the same WebService
between a Flask daemon on PyPy and an AsyncIO daemon on CPython, it was
very interesting: Compare to our needs, asynchronous pattern give us more
performance that PyPy.
Yes, I know, I've compared apples with pears, but at the end, I only want
how many customers I can stack on the same server. More I stack, less it
costs for my company.
I'm waiting Python 3.3 support in PyPy to push that on production with a
real daemon. No AsyncIO, No PyPy.

4. About Python performance: Two things changed my mind about the bias
"Python is slow":
                 A. Python High Performance:
http://shop.oreilly.com/product/0636920028963.do
                 B. Web Framework Benchmarks:
http://www.techempower.com/benchmarks/
Especially with B.: this benchmark isn't the "truth", but at least, you can
compare a lot of languages/frameworks based on examples more closer than my
use cases, compare to others benchmarks.
But, for example, if you compare Python frameworks with Erlang frameworks
on "multiple queries", you can see that, in fact, Python is very good.
In my mind, Erlang is very complicated to code compare to Python, but
you'll have better performances in all cases, I had a wrong opinion.
Finally, everybody has bias about programming languages performance.

5. Type Hinting - Performance booster (the first goal of my e-mail): Thank
you Guido, your example is clear.
I understand that it will be step-by-step, it's a good thing. I took the
liberty to send an e-mail, because I didn't sure to understand correctly
the global roadmap.
I'm the first to understand that it's very difficult, and maybe that
CPython will never use Type Hinting to improve performances, because it
isn't really simple to implement.
I'm pretty sure I can't help you to implement that, but at least, I can
promote to others.

Thank you everybody again for your attention.

Met vriendelijke groeten,


--
Ludovic Gasc

On Mon, Dec 22, 2014 at 6:06 PM, Sturla Molden <sturla.molden at gmail.com>
wrote:

> On 22/12/14 17:42, Nick Coghlan wrote:
>
>  a) communicate the potential of these tools effectively to new Python
>> users
>> b) ensure these tools are readily available to them (without turning
>> into a build nightmare)
>>
>
> For b), Anaconda by Continuum Analytics and Canopy by Enthought are doing
> a great job.
>
> But today it is also possible to create a minimalistic environment with
> only a few 'pip install' commands.
>
> It is not a build nightmare anymore.
>
>
> Sturla
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141223/b4ca83f9/attachment.html>


More information about the Python-ideas mailing list