Live data from Hacker News

Show HN: Python can make 3M+ WebSocket keys per second

github.com

21–30 of 75 posts

Re: Show HN: Python can make 3M+ WebSocket keys per second

#21
post #6

The hardest part of debugging Python is "hitting the wall" when you come to a native library (compiled C code). And Python has achieved a lot of speed-ups from Py2 to Py3 by adding more compiled C code. This is a real blocker for understanding the foundation library. On the other hand, in Java, with a few exceptions around Swing (native painting for GUIs) in Java, almost everything is written in pure Java, so you can…

Do you think that relying less in C code could be better for Python and it’s community? I mean less focus on being “glue” between C code and more focus con optimizing the interpreter?

Creator of LLVM and Swift is doing just that: https://www.modular.com/mojo

Re: Show HN: Python can make 3M+ WebSocket keys per second

#23

The hardest part of debugging Python is "hitting the wall" when you come to a native library (compiled C code). And Python has achieved a lot of speed-ups from Py2 to Py3 by adding more compiled C code. This is a real blocker for understanding the foundation library. On the other hand, in Java, with a few exceptions around Swing (native painting for GUIs) in Java, almost everything is written in pure Java, so you can…

Likewise, in C#, almost everything is written in pure C#.

It also gives you more control over memory allocations than Java, which is nice when trying to squeeze more performance out of the code.

Re: Show HN: Python can make 3M+ WebSocket keys per second

#24

The hardest part of debugging Python is "hitting the wall" when you come to a native library (compiled C code). And Python has achieved a lot of speed-ups from Py2 to Py3 by adding more compiled C code. This is a real blocker for understanding the foundation library. On the other hand, in Java, with a few exceptions around Swing (native painting for GUIs) in Java, almost everything is written in pure Java, so you can…

Mojo seems like a very promising solution, despite it being AI oriented. Lex Friedman had a great podcast with the founder, its first version was released about a month ago, and in two weeks got 10k discord users.

A superset of python that, once finished, can run all native python code, but also adds language features to get closer to the “metal”, getting speeds of C libraries with the ability to properly debug and step through it.

If this project goes the way it’s promised (the guy has great experience with language development), this could further cement python as it would solve its biggest criticisms. Very excited for it

https://youtu.be/pdJQ8iVTwj8 https://www.modular.com/mojo https://en.m.wikipedia.org/wiki/Chris_Lattner

Re: Show HN: Python can make 3M+ WebSocket keys per second

#26

> Show HN: Python can make 3M+ WebSocket keys per second > This article is about optimizing a tiny bit of Python code by replacing it with its C++ counterpart. So it's C++ rather than Python.

The article was posted by "cprogrammer1994", that should've been a hint!

Re: Show HN: Python can make 3M+ WebSocket keys per second

#28
I suspect part of the speedup is avoiding the python included base64 implementation. Third party extensions[1] claim fairly large improvements.

[1] https://github.com/mayeut/pybase64

This particular one also includes b64encode_as_string, which would also reduce some work/copying.

Re: Show HN: Python can make 3M+ WebSocket keys per second

#29

> Show HN: Python can make 3M+ WebSocket keys per second > This article is about optimizing a tiny bit of Python code by replacing it with its C++ counterpart. So it's C++ rather than Python.

The article was posted by "cprogrammer1994", that should've been a hint!

The first "C" stands for "Cython".

/s

Re: Show HN: Python can make 3M+ WebSocket keys per second

#30
post #20

The hardest part of debugging Python is "hitting the wall" when you come to a native library (compiled C code). And Python has achieved a lot of speed-ups from Py2 to Py3 by adding more compiled C code. This is a real blocker for understanding the foundation library. On the other hand, in Java, with a few exceptions around Swing (native painting for GUIs) in Java, almost everything is written in pure Java, so you can…

On the other hand, you still have to learn and use Java. I think learning Python and a touch of C is easier than trying to learn Java. Heck I'd go so far as to say C is a lot easier than Java. Frankly I don't understand why having to learn a little bit of C to debug a python program is such a red flag or wall to you, considering the sheer amount of learning one has to do to use Java at all. You're setting up an uber-…

> You're setting up an uber-sophisticated IDE

You just install it.

> learning a little C and potentially fixing an up-to-date and beloved library

A romantic thought, but 99% of the time I'm just going to do a workaround or a local patch.

I don't use Java anymore, but I don't hate it. I think it has some verbose conventions, but I vastly prefer it to C's extremely terse conventions.

Nowadays I try to do as much in TypeScript as I can, because I find it a pleasure to use, and it has the same property where you can dive into any lib when debugging.

Post reply on HN