3 ms·
I think the use of uvloop is reasonable, since it's not something domain specific to Redis. But doesn't the inclusion of hiredis invalidate the entire point? I
by nemetroid 6y ago
I think the use of uvloop is reasonable, since it's not something domain specific to Redis.
But doesn't the inclusion of hiredis invalidate the entire point? It's 7500 lines of C specifically for working with Redis.
- quietbritishjim 6y agoI agree with this. If you write an application in Python that spends the majority of the time in C-based extensions – for example if I were to write a differential equation GUI using numpy and pyqt – then I think it's still valid to say that I wrote the application in Python. In fact even most of the standard library modules are written in C (e.g. zipfile, io, sqlite3) so it's hard to avoid this. You could say that no program is ever really written in Python but I don't think that's a useful point to make.[1] But if you write a load of C code that's very specific to your application, wrap it in a Python extension, then call it from Python, then I don't think you could argue that you "wrote it in Python". If someone happened to have written that application-specific extension module for you then the situation is not materially different. ([1] A more useful motion is whether your code is vectorised. That is, if you want to do something with a data structure (e.g. mutate each element, find an element, do matrix multiplication), do you have to loop over the elements in Python or do you make a single call into a library that does the looping in C? Either way you're still ultimately going to be calling C code, if nothing else in the Python interpreter itself, but the distinction is obviously still important.)
- formerly_proven 6y agoThe Python zipfile module is actually just that, Python. It performs well enough, with compression zlib is the limiting factor anyway.
- quietbritishjim 6y agoOK, by my own rules that means it's "written in Python" then. But in that case what I actually meant is that majority of time in calls to zipfile is spent in pure C, not in the Python interpreter loop, and if it's based on zlib then that agrees with what I meant. (There is an exception I didn't mention: if the zip is encrypted then the zipfile module falls back to pure Python code. The difference is very noticeable!)
- lr4444lr 6y agouvloop also unfairly lets Python take credit for concurrent request handling performance too though, no?