From: Steve C. <ste...@mq...> - 2002-03-14 00:38:29
|
Hi folks, Steve the whiner here again... we've just hit some major inneficiencies in the tcl interface to AG, this came when we tried to draw a real annotation in our new labeller and it took 1000 seconds to complete 250 annotations. The bottleneck turned out to be calls to the AG routines to get anchor times, specifically: [::AG_GetAnchorOffset [::AG_GetStartAnchor $entry]] To get some figures I wrote a short tcl script which creates an annotation (copied from ag_wrapper_test.tcl) and then times calls to the above fns. The script is attached but the output is: tclsh timer.tcl getting start times for 3 nodes [::AG_GetAnchorOffset [::AG_GetStartAnchor $entry]]: 10650 microseconds per teration [::AG_GetStartAnchor $entry]: 6104 microseconds per iteration for comparison I wrote a similar script using Emu, accessing the same kind of information (start/end times) which is stored in the same way (as a member variable in a C++ class): getting start times for 5 nodes 232 microseconds per iteration This is a significant overhead which is going to make writing useable user interfaces difficult if it is reflected accross the API as I suspect. I haven't compared these times to a raw C++ version but I'm hoping that that would be significantly faster and that the bottleneck is in the wrapper code. Looking at the code it seems that there is a lot of indirection in the scripting wrapper that could probably be avoided. SWIG can take care of converting things to strings if needs be. I wonder if we shouldn't look at how this is done and perhaps have another bash at the wrapper interface. I note that all the interfaces in AGAPI.h are in terms of strings so a simple SWIG wrap of AGAPI.h might well work -- was this tried? We're working on another SWIG project here at the moment (wrapping the Edinburgh speech tools) and so it might be worth our looking at this again at the same time while we still understand SWIG! Comments welcomed. Steve |