Sujet : Re: Nice example about the "inefficiently" of the tcl "c" api.
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tclDate : 09. Sep 2024, 07:04:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbm35g$2a7ue$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
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.