Deutsch   English   Français   Italiano  
<vbm35g$2a7ue$1@dont-email.me>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968 <aotto1968@t-online.de>
Newsgroups: comp.lang.tcl
Subject: Re: Nice example about the "inefficiently" of the tcl "c" api.
Date: Mon, 9 Sep 2024 08:04:32 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <vbm35g$2a7ue$1@dont-email.me>
References: <v9ggb7$2dcu$1@dont-email.me> <vbfp4d$utpf$1@dont-email.me>
 <vbk7dp$1u949$1@dont-email.me> <WBhDO.40879$g_vf.9825@fx03.iad>
 <vbklqj$20bs6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 09 Sep 2024 08:04:32 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="fb882121e9a8679b7ed7c229a0766461";
	logging-data="2432974"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18IfH4Wz83+d87ckp2SViAgsSdUyFiMeBw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:DzBY649qsfuvynXJP8S7+zo3HBw=
Content-Language: en-US
In-Reply-To: <vbklqj$20bs6$1@dont-email.me>
Bytes: 2487

On 08.09.24 19:10, Christian Gollwitzer wrote:
> 
> Also my conclusion. As far as I understand it, he has written his own warpper generator - something like SWIG - and calls ist 
> "universal compiler" or similar names. His Tcl wrappers are much slower than his Python wrappers. It seems that he creates TclOO 
> objects in his code. I would suggest to simply use SWIG and then talk about the performance. My guess is that SWIG wrappers will 
> not show any difference between Tcl and Python (because they are not based on TclOO in Tcl, which is not necessary to get an OO 
> interface).
> 

SWIG is far less than ALC but you are right TCL is much slower than PYTHON in C integration. it is an "design" issue of the API
because in PY all (basic) objects are instances and these instances are defined in C. The tcl OO is like an and-on to the TCL 
language and in PY it IS the PY language.

I posted the code above just to show some simple facts:
1. Tcl has no "NULL" object → "NULL" is not even defined in Tcl
2. Tcl has no C-API to get/compare a "TYPE" of an object like Py_TYPE.
3. even to get an simple pointer from an object is just a C cast in PY and a
    HASH table lookup in TCL

tcl has an advantage that TCL has an usable THREAD interface BUT this thread interface "cost" ~30% performance
compared to non-thread.