-
Notifications
You must be signed in to change notification settings - Fork 31
Pypy support #10
Comments
Thanks for raising the issue! There seems to be some demand for Pypy, but I would like to understand a bit more why is that. Currently I am not super enthusiastic about supporting older Python versions or Pypy, but perhaps some discussion here can change mind. As far as aioinflux is concerned, the most CPU-intensive part of the code is the serialization part (i.e., transforming a dictionary/dataframe to a line protocol string). I have been aware of that and have stated it in the README:
As a side note, please understand that the current pure Python line protocol serialization implementation is somewhat optimized, and according to my simple benchmarks, it is 7-8x faster than the official Python client (which is a pity and one of the many reasons I decided to write my own InfluxDB client library from scratch). Serialization can likely be improved a bit (hopefully 2-3x) using Cython, or perhaps even more by writing a C extension from scratch (such as ciso8601). So I would like some clarification on:
My concerns are:
By the way, @miracle2k has made his own fork of aionflux, which supports trio/curio/asks and Python 3.5 (and I assume Pypy as well). It would also be nice to hear some opinions from other contributors: @steersbob, @carlos-jenkins. |
Note: I have little to no practical experience with PyPy. That said: This seems to be the primary influx + asyncio library. It may be desirable to focus on doing the core feature well, instead of supporting everything up to and including a mail client. I may be available to write a C serializer, but that'd depend on how much effort it would be, and what the expected performance gain would be. |
Thanks for you detailed response! Here are some answers to your points I am definitely not enthusiastic about supporting old versions of Python either, and I was not suggesting supporting anything other than pypy-3. (Concerning the C-parser/serialiser, I don't have much experience with C extensions, but I think using CFFI works very well with both CPython and Pypy) And lastly, regarding use-case: I understand that for the aioinflux part of the code, once the C parser/serialiser has been implemented, running on Pypy will not improve the performances at all. But we are using aioinflux to connect to a large InfluxDB, with some data processing that we would like to be able to do efficiently in our Python code. Using Pypy for this processing would definitely speed thing up. I understand that supporting old versions is definitely not an objective here, but I think processing data on the Python side is a common use-case, and supporting Pypy probably won't impact the code much here. Finally: I think we have three options here:
[1] https://morepypy.blogspot.fr/2017/12/pypy27-and-pypy35-v510-dual-release.html |
@arthurdarcet: I just released v0.3.0 so now perhaps is a good time for you to fork and make the necessary adaptations. Besides async generators, aioinflux also makes heavy use of f-strings (which are 3.6+ only). They are quite useful for serialization and considerably faster than regular I think it'd be nice supporting Pypy, but as stated above I am a bit hesitant due to maintainability issues. From the three options you gave, I am a bit more inclined to option two, but feel free to make a fork and open a pull request (option one). We can take a look at it and try to merge it to the master branch. If you don't need Pandas support, dropping dataframe support for the Pypy version would also be an option. |
f-strings are available in pypy3 since 5.8, so this won't be an issue. I'm not exactly sure how we can specify in the setup file that the project requires python 3.6 or pypy3 5.8... I'll look into that. I probably won't have time to work on this in the next few days, but I'll open a PR when a get a chance |
This lib could be useful to manipulate large amounts of data ; and Pypy can help speeding thing up for those use-cases, but Pypy is marked compatible only with python 3.5, and cannot be installed with the
python_requires=3.6
specified in the setup.py file.I don't think anything in the code requires 3.6 other than the async generators. Would you consider a PR lowering the
python_requires
to 3.5 and add a dependency onasync_generator
to support 3.5 ?The text was updated successfully, but these errors were encountered: