2 ms·
The main function vs script difference is due to search in the name spaces of a function and global. The function is a tiny array, while the global one is a dic
by gostsamo 6y ago
The main function vs script difference is due to search in the name spaces of a function and global. The function is a tiny array, while the global one is a dictionary with the need of hashing and possible collision resolution. Do it enough times and it shows.
The relative slowness is not unexpected. A stated non-goal of python is speed optimization. If you need such, you can try with pypy. At the same time, Node is purely performance driven and the jit compiler there is tuned for this.