[vtkusers] slow down when use tcl api

Chen Fu novalet at yahoo.com.cn
Thu Apr 10 01:45:50 EDT 2003

yesterday i write a letter about my experience in
using tcl/vtk in MFC program. 
But in fact, the problem is nothing to do with the
MFC, because even the simplest c file will have such
Look, below is the simplest tcl interpreter i written
in tcl API.


#include	<tcl.h>
#include	<tk.h>
#include	<stdio.h>
int app_init(Tcl_Interp *interp);
int	main(int argc, char **argv)
	Tk_Main(argc, argv, app_init);
	return 0;
int app_init(Tcl_Interp *interp)
	if(Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
	if(Tk_Init(interp) == TCL_ERROR) return TCL_ERROR;
	return 0;

Compile it to a exe called "mytcl.exe", then i use
this simplest  tcl interpreter to run the script in
the vtk. for example

mytcl capcow.tcl
wish83 capcow.tcl

you can also exam with other tcl script. The
conclusion is the wish83 run much faster than mytcl.
So the tcl api must be the source to hinder the vtk
rendering speed.

I hope the pals on the list help:
(1) exam the same test on a linux platform.
(2) maybe some guru can compare the wish83 code with
the tcl api to find out what's wrong.

My aim is using tcl to organize vtk pipeline in a
c/c++ program, but if this design will slow the
program so much, it would not be a good idea.
But i can't understand why the api have a performance
problem, i guess the wish83 or tclsh83 are built on
the base of such api.

PS my OS is win2k, i have test it on both vc6 and vc7,
both debug and release mode (vc6 has a worse
performance :< )

Remote Scensing Satellite Ground Station
Chinese Academy of Science

Do You Yahoo!? 
雅虎通网络KTV, 随时随地免费卡拉OK~~

More information about the vtkusers mailing list