Earlier quoted context omitted.
Armin Ronacher, author Flask, actually has a good talk about this. The gist of it the way Python's internals leak into the language makes it very difficult to build a performant JIT that wouldn't break a large amount of userspace code. Python lets you do _far_ more shenanigans that Javascript does; and a lot of large libraries depend on some of that behavior. Breaking it would probably cause a new 2 -> 3 situation. h…
> Python lets you do _far_ more shenanigans that Javascript does Does JavaScript let you do this monstrosity of terrible code? Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class Dog(object): ... def speak(self): ... print("bark!") ... >>> class Cat(object): ... def speak(self): ... print("me…
Node.js 14 is over 20x faster than Python3.8 for fib(n)
101–110 of 119 posts
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#102Earlier quoted context omitted.
Armin Ronacher, author Flask, actually has a good talk about this. The gist of it the way Python's internals leak into the language makes it very difficult to build a performant JIT that wouldn't break a large amount of userspace code. Python lets you do _far_ more shenanigans that Javascript does; and a lot of large libraries depend on some of that behavior. Breaking it would probably cause a new 2 -> 3 situation. h…
> Python lets you do _far_ more shenanigans that Javascript does Does JavaScript let you do this monstrosity of terrible code? Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class Dog(object): ... def speak(self): ... print("bark!") ... >>> class Cat(object): ... def speak(self): ... print("me…
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#103This is a pretty terrible implementation of fib(n).
Regardless node IS definitively one of the fastest interpreted platforms around. It is well known that it is faster than python. Python wins in other areas, including being a much much better designed language.
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#104Earlier quoted context omitted.
I’ve been scripting in Python since 2003. Node wasn’t mature/viable at the time. Edit : didn’t exist at the time! Python is my go-to because I know the ecosystem well and can go from zero to done with minimal effort and research. Node has since (come into existence) and matured, and while it may be better/faster in some situations now, I haven’t encountered a project that has compelled me to switch. I suspect the ans…
Node.js was created in 2009, so it wasn't even born in 2003: https://en.wikipedia.org/wiki/Node.js
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#105Earlier quoted context omitted.
I would expect numba to win, but I also do not think it is a fair comparison.
To be fair, python itself isn't jitting anything, while node is.
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#106Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#107An interpreter with a JIT is obviously faster than one without. Especially when dealing with CPU bound work. I'm not sure this is entirely noteworthy unless you somehow think CPython has a JIT. Would be much more interesting to compare to pypy.
> An interpreter with a JIT is faster than one without. Especially when dealing with CPU bound work. Would be interesting to compare to pypy.
Sure, here is pypy:
> pypy3 main.py
282 ms
> node main.js
105 ms
Without JIT: > python3 main.py
2818 ms
> node --jitless main.js
998 ms
For fun: > cargo run --release -q
20 ms
I enjoy brrrrrm's post for its brevity and the acknowledgement of common folk tools.Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#108Doesn't the Node.js version use double precision floating point vs python using infinite precision integers ? That would explain part of the difference in performance, and make the python version exact, but js version inexact.
The numbers are small so there shouldn’t be any difference for fib(35)
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#109An interpreter with a JIT is obviously faster than one without. Especially when dealing with CPU bound work. I'm not sure this is entirely noteworthy unless you somehow think CPython has a JIT. Would be much more interesting to compare to pypy.
Let me help you detox that: > An interpreter with a JIT is faster than one without. Especially when dealing with CPU bound work. Would be interesting to compare to pypy. Sure, here is pypy: > pypy3 main.py 282 ms > node main.js 105 ms Without JIT: > python3 main.py 2818 ms > node --jitless main.js 998 ms For fun: > cargo run --release -q 20 ms I enjoy brrrrrm's post for its brevity and the acknowledgement of common f…
.\php fib.php 1402.1289348602 ms
and with PHP8's new JIT opcache on:
.\php -dopcache.enable_cli=1 -dopcache.jit_buffer_size=200M fib.php 219.55609321594 ms
Re: Node.js 14 is over 20x faster than Python3.8 for fib(n)
#110Earlier quoted context omitted.
Armin Ronacher, author Flask, actually has a good talk about this. The gist of it the way Python's internals leak into the language makes it very difficult to build a performant JIT that wouldn't break a large amount of userspace code. Python lets you do _far_ more shenanigans that Javascript does; and a lot of large libraries depend on some of that behavior. Breaking it would probably cause a new 2 -> 3 situation. h…
> Python lets you do _far_ more shenanigans that Javascript does Does JavaScript let you do this monstrosity of terrible code? Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class Dog(object): ... def speak(self): ... print("bark!") ... >>> class Cat(object): ... def speak(self): ... print("me…
class Dog {
speak() {
console.log("bark!");
}
}
class Cat {
speak() {
console.log("meow!");
}
}
animal = new Dog();
animal.speak();
Object.setPrototypeOf(animal, Cat.prototype);
animal.speak();
This will produce: bark!
meow!