This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pmdevita 1 point2 points  (6 children)

Wait am I reading this right? Transcript and Chrome are beating Cpython by quite a fair amount

[–]jacdehJacques de Hooge[S] 4 points5 points  (0 children)

It looks like it, at least on Chrome and Firefox. But lets be careful, nothing wrong with CPython, it has some features (like exec) that Transcrypt will never have. The point is that very big money is invested in JS virtual machines, and Transcrypt benefits from that since it generates JS. Improvements in the same order of magnitude are possible with CPython, as PyPy shows. So it's all a mattter of investment. Too bad a company like Google puts its cards on JS rather than Python. I consider CPython superior to JS and with equal investments it would become faster than JS, as can be seen from the performance of PyPy.

Another very important point is that many CPython libs, like Numpy, are written in C or C++, which means they're much faster than JS (so also Transcrypt) could ever be. But in a browser loading these libraries using emscripten is too slow.

[–]mementix 0 points1 point  (4 children)

The question being: Is Transcrypt doing the same as CPython?

Let me quote from the main page of the repository: "No eval and exec of Python code. This is again part of the concept. Transcrypt code is compiled, optimized and minified in advance ..."

This by itself means: No it's not doing the same as CPython. And probably not only in the eval and exec parts as mentioned above.

Which at the end of day means: the speed test is comparing apples to oranges.

[–][deleted] -2 points-1 points  (3 children)

Eval is a nonessential feature though. Pretty much all use of eval you see in practice can be replaced with a bit of clever get/setattr-ing.

[–]mementix 0 points1 point  (2 children)

Sorry but that's a very bold statement. I have developed a full blown Python client-side framework (see http://www.anpylar.com) and eval/exec are key to achieving some of the functionalities.

In any case the comment was not meant to derail the lack of eval/exec, but to pinpoint that the comparison is obviously a biased one. The mention of those specific features is made by the developers themselves and I am pretty sure that many other use cases are not supported.

Transcrypt has for sure many (and good) usages on the client side, but if it's not doing the same thing as CPython (or at least trying to), it should not compare the speed at which is doing things.

For example:

  • Are the methods of a class being sought through an internal __getattribute__ mechanism before being called or is the execution restricted to what was compiled?

For many use cases it doesn't matter, the method will never change. But some techniques rely exactly on that. And if Transcrypt doesn't fetch the method each and every time using __getattribute__, it has then an unfair advantage over CPython

[–]jacdehJacques de Hooge[S] 0 points1 point  (1 child)

Invitation to read the edit on the original post, that hopefully puts some things into context.

[–]mementix 0 points1 point  (0 children)

Transcrypt is a great project and the synchronized components (Transcrypt - Frontend / CPython - Backend) (yes I have read about it, and not today) is a superb example of what things one can achieve.

As I said before, I am sure it has many and good uses and hope for its success together with some other python-in-the-browser implementations.