Hi Friends!
I've seen here curious thread on comparing TCL speed with Python - and
as a "sequel" to it here is more TCLish observation.
It happened that I was also measuring languages performance (for
practical purpose - to get understanding how much calculations would fit
in 1 second limited sandbox on my site). There are two tests - for plain integer calculations - and for calculations involving array.
I initially used list as array and while performance is somewhat lower
than with other popular scripting languages, I thought it is quite
decent, regarding list implementation (I thought it is a kind of space-separated string by then).
Then I browsed TCL tutorial and rewrote implementations using array and finally, dict. They were
significantly worse, which is explainable as they are not necessarily
tuned to work as linear array - but I was somewhat surprised to see the "dict" is the worst of all (perhaps it in improved in the versions above 8.5):
C (long long): 4.28
PHP: 11.99
Python3: 42.57
TCL (list): 63.30
TCL (array): 104.78
TCL (dict): 112.41
Lua: 33.75
Implementation is here and you are welcome to check whether I missed
some obvious way to improve results: https://github.com/rodiongork/languages-benchmark
As a sidenote, PHP and Lua use single version of array for both "linear"
and "dict-like" storage.
Python has the equivalent of Lists, Arrays, and Dictionaries -- which
did you use?
For calculation, C or Golang would likely be best.
Hi Friends!
I've seen here curious thread on comparing TCL speed with Python - and
as a "sequel" to it here is more TCLish observation.
It happened that I was also measuring languages performance (for
practical purpose - to get understanding how much calculations would fit
in 1 second limited sandbox on my site). There are two tests - for plain integer calculations - and for calculations involving array.
I initially used list as array and while performance is somewhat lower
than with other popular scripting languages, I thought it is quite
decent, regarding list implementation (I thought it is a kind of space-separated string by then).
Then I browsed TCL tutorial and rewrote implementations using array and finally, dict. They were
significantly worse, which is explainable as they are not necessarily
tuned to work as linear array - but I was somewhat surprised to see the "dict" is the worst of all (perhaps it in improved in the versions above 8.5):
C (long long): 4.28
PHP: 11.99
Python3: 42.57
TCL (list): 63.30
TCL (array): 104.78
TCL (dict): 112.41
Lua: 33.75
Implementation is here and you are welcome to check whether I missed
some obvious way to improve results: https://github.com/rodiongork/languages-benchmark
Python has the equivalent of Lists, Arrays, and Dictionaries -- which
did you use?
in Python the plain list is used (well, these details could be quickly
seen by the link to sources above) - as I mentioned in TCL I decided to
try other structures only because I thought list implementation could be
not very effective internally, e.g. due to historical reasons...
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 119:34:37 |
Calls: | 12,958 |
Files: | 186,574 |
Messages: | 3,265,636 |