Deutsch   English   Français   Italiano  
<96ddc76b99ce6bf7397a5158fece845f@www.novabbs.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!nntp.comgw.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: RodionGork <rodiongork@github.com>
Newsgroups: comp.lang.tcl
Subject: Performance of list / array / dict compared
Date: Sun, 18 Aug 2024 07:41:37 +0000
Organization: novaBBS
Message-ID: <96ddc76b99ce6bf7397a5158fece845f@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
	logging-data="2979712"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="FK20xSPHkh3K4vnO8u2oiUWWGFHCzgkK4jO78trwjP4";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Posting-User: 32ecc5e38066f1efcacd4ff0a351d3cb52726446
X-Rslight-Site: $2y$10$lAvj0jhfXjK6.KliTRXt3.o.h8lkQRoCefgYu15OPN3a1qQ46ToCy
Bytes: 2311
Lines: 39

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.

-- 
to email me substitute github with gmail please