Live data from Hacker News

Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

github.com

111–120 of 192 posts

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#111

I'm feeling old. I went back to Flask recently and keep finding everything I know is deprecated, or not best practice any more. Then I read every week that some new framework is out that is better. I'm tired of it. I end up spending more time learning new things than I do building new things! Maybe I should get off hn for a while

This helped me: Nobody asks a professional violin player to "just" switch to the cello, because the orchestra is missing one. Yes, there are many musicians who are proficient in multiple instruments, and yes, the underlying music theory is the same and maybe even the playing mechanics might be very similar (e.g. within strings or winds).

A few years ago I made a conscious decision that - at least during my remaining professional career - I will not switch to a new programming language anymore. Instead, I intend to keep specializing in Java. I embrace the fact that in 20 years I will be today's (Assembly|Fortran|C|...)-specialist. I do enjoy reading about other language features. I applaud the people at the cutting edge, experimenting with new stuff, and I am glad that Java is slowly incorporation some of those innovations. Every LTS release (2-3 years), I enjoy learning the curated set that Oracle's language architects decided to add.

This decision helped me tremendously with the fear of missing out on the latest and greatest.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#112
post #67

Earlier quoted context omitted.

Technically, it is C that’s faster.

Technically (not sure what you mean with this but with the context I will use it too as it seems to match with what I want to say) you could never talk about Python (the most common and original implementation) without making reference to C then. And if you are not making reference to a specific implementation then the comparison does not make any sense.

Isn't there a difference between interpreting Python code with CPython (which I would call "Python") and running compiled C from Python (which I would call "C")?

Then it kind of make sense to talk about " pure Python" (the interpreted one) and "wrapped C", doesn't it?

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#113
Yet another "X faster than Y" where inside X all hot jobs are done by really good-tuned C or C++. Facepalm.

Without real problem-solving (business logic) written in Python, this is only lightweight wrapper on C/C++. When the number of Python code start growing in the hot path, then these blazing-amazing thruput numbers tremendously will be going down.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#114

Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter. Just as a piece of evidenc…

For all practical purposes, a programming language is defined by it's general real world implementation, and not it's specification. Maybe not so much for computer scientists, but for programmers, Python is interpreted with some JIT alternatives and C++ is compiled.

I literally posted the links to the AOT Python compiler and to the C++ interpreter.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#115

Earlier quoted context omitted.

> Making a new implementation is a practical purpose. Not yet it isn't. At least not for Python. I mean there are plenty of alternative implementations of Python but they aren't practical because they don't work with CPython modules (as far as I know anyway) so approximately nobody uses them. The de facto spec is "what CPython does".

PyPy work well with CPython modules but the performance is not that great, with CFFI performance is really good in PyPY, HPy project will change this https://hpyproject.org/

[deleted]

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#117

Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter. Just as a piece of evidenc…

Even if there isn't literally such a thing as an "interpreted language" there are absolutely design choices made in Python that you wouldn't make if you wanted it to be fast at runtime. To be fair, this is also true of JavaScript, but in Python the choices were literally intentional, as simplicity of CPython and elegance of the language were long valued over performance.

OTOH, interpreting C++ is actually a pain in the ass due to design choices it makes specifically regarding the semantics of translation units. You can see similar pain when trying to say, make a Go REPL: it's just not tuned for this.

It is of course technically possible to compile almost anything ahead-of-time. But, if you effectively wind up having to ship an interpreter or JIT into the resulting binary to run some code anyways, it's almost for naught. Both Python and JavaScript have eval. Python also has several other cases like Pickle where this can be an issue. PyPy being a JIT makes a lot of sense because it wants to be a drop-in replacement, and that makes the most sense for a language with these constraints. Codon can do AOT, but for practical reasons it is not nearly a drop-in replacement for CPython, just like the other Python AOT implementations.

A practical Python AOT is not compatible with loads of things that people associate with Python, like Django. PyPy is compatible with more, but even it is far from a drop-in today, and that is a problem.

> A language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter.

This is objectively true. However, in practice, there are a finite number of available toolchains for any given language that exist today, and creating new ones is a non-trivial endeavor, especially production-quality ones. A language is just a set of rules and keywords. However, when people use Python and write Python, they are not merely writing Python to fit into those keywords and rules. They're writing Python to be executed and solve a problem, typically using CPython. Python is a language, but it's also an ecosystem.

In the same token, if something like Codon doesn't even support all of the things you can fit into Backus-Naur form about Python as it is in CPython and PyPy, can it even be called Python in this sterile technical sense?

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#118

Earlier quoted context omitted.

This is false. Making a new implementation is a practical purpose. Any new implementation will have to work with the spec, instead of idiosyncracies of other implementations. Ergo there are practical purposes which go by how the language is defined in its specification. Some languages have more of a proper spec than others, of course. If we look at for example Scheme dialects, then they often change their implementat…

> Making a new implementation is a practical purpose. Not yet it isn't. At least not for Python. I mean there are plenty of alternative implementations of Python but they aren't practical because they don't work with CPython modules (as far as I know anyway) so approximately nobody uses them. The de facto spec is "what CPython does".

I heard that very argument about GCC. C++ without __attribute__ is not practical for embedded development therefore C++ for PLCs is what GCC does. And yet, the general consensus now is that C++ is ISO/IEC 14882, and what GCC does is just an implementation.

With Python, you don't even have to go "alternative" to use LLVM compiler infrastructure. You can use CPython + Numba and compile your kernels for both CPU and GPGPU on the go. Which is very practical.

Which is ironic, to compile a CUDA kernel in C++, you would have to use an alternative NVidia implementation of the language.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#119
post #113

Yet another "X faster than Y" where inside X all hot jobs are done by really good-tuned C or C++. Facepalm. Without real problem-solving (business logic) written in Python, this is only lightweight wrapper on C/C++. When the number of Python code start growing in the hot path, then these blazing-amazing thruput numbers tremendously will be going down.

I'm so happy this is (currently) the top comment and people are starting to realize measuring perf with these well tuned micro-benchmarks is a sham.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#120

Very cool, I will bookmark this since I am out on a look for a new backend framework for an api I am building.

https://discord.socketify.dev/

Sorry for all the hate you seem to be recieving, I think it looks great!

I can't join the discord however since I was banned for unknown reasons and cannot create a new account without giving them my phone number, which I refuse to do.

But remember many great things get hated upon in the beginning, take dropbox as an example. People on HN thought it was a shitty idea and they seem to be doing just fine :)

Post reply on HN