I made some performance improvements to the updated Tcl::Tk package:
I added a /benchmarks/ directory to the source distribution and created
three test scripts:
*StressTest*: This is Vadim's original benchmark. This basically creates
many embedded buttons in a text widget.
*entryBench*: This creates a lot of entry widgets in a window.
*bigCanvBench*: This creates a lot of canvas items on a canvas.
Results before/after the optimizations are shown below. The Tcl::Tk
benchmarks were made using the normal $widget->MethodName calls, and the
"fast" $widget->_MethodName calls. For comparison, perl/tk times are
also included.
*Summary*:
For stressTest and entryBench, the updated results are better than
perl/tk but not quite as good as the stock Tcl::Tk 0.97. (There is some
overhead with the perl/tk compatibility changes).
For the bigCanvTest benchmark, the updated Tcl::Tk is equal to the
perl/tk times. Before the update, these times were significantly slower
than perl/tk.
Platform: perl 5.8.4 on a windows XP box.
*StressTest Benchmark*: Before Optimization
This creates a bunch of embedded buttons in a text widget
$text->Button Calls $text->_Button Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 7 3.5
Tcl::Tk 0.97 2.6 2.2
Perl/Tk 804.027 6 --
*StressTest Benchmark: *After Optimization
$text->Button Calls $text->_Button Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 4.7
2.6
Tcl::Tk 0.97 2.4 2.2
Perl/Tk 804.027 5.8
--
*entryBench Benchmark: *Before optimization
This creates a lot of entry widgets in a frame
$mw->Entry Calls $mw->_Entry Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 18.0 12
Tcl::Tk 0.97 6.7 6.0
Perl/Tk 804.027 25 --
*entryBench Benchmark: *After optimization
$mw->Entry Calls $mw->_Entry Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 13.0 9
Tcl::Tk 0.97 6.8 6.2
Perl/Tk 804.027 25.3 --
*bigCanvTest Benchmark: *Before optimization
This creates a lot of canvas items (lines) on a canvas
$can->CreateLine Calls $can->_CreateLine Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 9.0 3
Tcl::Tk 0.97 6 3
Perl/Tk 804.027 3 --
*bigCanvTest Benchmark: *After optimization
$can->CreateLine Calls $can->_CreateLine Calls
_Package_ _Time (s)_ _Time (s)_
Updated Tcl::Tk 3.2
3
Tcl::Tk 0.97 6 3.4
Perl/Tk 804.027 3 --