Live data from Hacker News

PyPy.js: Now faster than CPython

rfk.id.au

61–70 of 80 posts

Re: PyPy.js: Now faster than CPython

#61
post #57

In the browser environment, people usually use quite a few inline anonymous functions. Javascript is great at this since you can define full-blown anonymous functions anywhere. Python, on the other hand, is definitely one of the worst at this. You can only create one-line, single-expression anonymous function with its lambda keyword. Of all the languages you want to convert to JS so that it runs on the browser, Pytho…

I really don't understand this obsession with anonymous functions. If you're doing anything longer than one line, there is absolutely no reason why you should be sticking the entire function definition as a parameter. I've had great usage from Javascript where I have separate functions with proper names and formatting, and then pass a reference to them into the code that asks for them. Can someone please enlighten me…

I suggest you read SICP and gain an appreciation for higher-order functions. Once you do, you will probably have answered your own question. http://mitpress.mit.edu/sicp/

Re: PyPy.js: Now faster than CPython

#62
post #26

Earlier quoted context omitted.

Yes, Safari has been working on an LLVM-based JIT called FTL. It now outperforms v8 on almost all asm.js benchmarks, http://arewefastyet.com/#machine=12&view=breakdown&suite=asm... That's not in release versions of Safari yet, it was just enabled on trunk. But it will make Safari very competitive once more.

What if LLVM based JITs with NaCL style security were available in all browsers except IE? (I'm just assuming Microsoft will drag their heels.) Then an LLVM IR based bytecode could become a standard bytecode for browsers.

I believe that in many ways, this would be ideal. Not only could any language be used (the implementers being responsible for interfacing with the browser API), but the LLVM pseudo-asm could be pre-optimized saving the browser a lot of work.

In the meantime, browsers would still be free to compete based on their JIT implementations.

With rust and by proxy, Mozilla/Samsung's experimental Servo layout engine targeting the LLVM, I can also see potential synergy in this situation.

Re: PyPy.js: Now faster than CPython

#63
post #48

Earlier quoted context omitted.

Clean and efficient concurrency primitives? I think not? I would be very interested if that is indeed the case.

Stackless Python has very clean and efficient concurency primitives, something lot of people dont seem to know..

> Stackless Python has very clean and efficient concurency primitives, ....

Sounds like a good topic for a post (or at least a link - hint, hint).

Re: PyPy.js: Now faster than CPython

#64
post #61
post #57

Earlier quoted context omitted.

I really don't understand this obsession with anonymous functions. If you're doing anything longer than one line, there is absolutely no reason why you should be sticking the entire function definition as a parameter. I've had great usage from Javascript where I have separate functions with proper names and formatting, and then pass a reference to them into the code that asks for them. Can someone please enlighten me…

I suggest you read SICP and gain an appreciation for higher-order functions. Once you do, you will probably have answered your own question. http://mitpress.mit.edu/sicp/

Why would zo1 want to read SICP? zo1 is clearly quite happy with Python's named functions, and has no immediate incentive to "read SICP and gain an appreciation for higher-order functions."

Re: PyPy.js: Now faster than CPython

#66
Still trying to find a suitable "python to js compiler written in js that runs in the browser" project.PyPy.js is unfortunatly too big and all the other projects i found are either written in python or dont pass the browserify step.I need a transpiler that runs in the browser.

Re: PyPy.js: Now faster than CPython

#67
post #23

Earlier quoted context omitted.

I still don't get the point of using Go instead of PyPy or Cython.

Because Go is at least as fast as PyPy or Cython, have a similar coding feeling to Python, have language level concurrency support, and has a clear/consistent development roadmap moving forward. PyPy is not really a good example here. It is still highly experimental, takes long time to compile, it's not compatible with quite a few libraries in normal Python, and still has all relative downsides of dynamic typing. To…

The issue is not about writing clean new programs in Go, but rather re-writing whole code bases from Python into Go, instead of trying out Python implementations that offer better performance than CPython.

Re: PyPy.js: Now faster than CPython

#68
post #48

Earlier quoted context omitted.

Stackless Python has very clean and efficient concurency primitives, something lot of people dont seem to know..

> Stackless Python has very clean and efficient concurency primitives, .... Sounds like a good topic for a post (or at least a link - hint, hint).

There are plenty of examples on http://www.stackless.com/ :)

Re: PyPy.js: Now faster than CPython

#69
post #61
post #57

Earlier quoted context omitted.

I really don't understand this obsession with anonymous functions. If you're doing anything longer than one line, there is absolutely no reason why you should be sticking the entire function definition as a parameter. I've had great usage from Javascript where I have separate functions with proper names and formatting, and then pass a reference to them into the code that asks for them. Can someone please enlighten me…

I suggest you read SICP and gain an appreciation for higher-order functions. Once you do, you will probably have answered your own question. http://mitpress.mit.edu/sicp/

Doesn't that section use lambda for anonymous functions? http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-12.html...

The OP is complaining about lambda functions in Python.

Re: PyPy.js: Now faster than CPython

#70
post #17
post #2

I felt it was a grave mistake for Python to direct the community effort into backwards incomparable Python 3, rather than on focusing on the speed (and better profiling instrumentation) of Python 2 (perhaps adding a standard JIT compiler). As a result, had our company started now, we would have written our Twisted server in C or Go instead of Python like we did.

Did you consider PyPy? It kinda works and it kinda focuses effort on being a faster replacement.

Yes we have: May 2 16:58:35 db2 kernel: [11106.666665] pypy[5672]: segfault at 18 ip 00000000010d9f39 sp 00007fff73204fa8 error 4 in pypy[400000+11dd000]
Post reply on HN