[tcltk-perl] sub declare_widget
by Vadim Konovalov other posts by this author
Jan 18 2005 4:39PM messages near this date
[tcltk-perl] currently documentation Tcl::Tk is a big mess,
|
[tcltk-perl] Tcl::Tk recent changes
Given following stress-test script:
use Tcl::Tk qw(:perlTk);
my $t0=time;
my $mw = tkinit;
my $tw = $mw-> Scrolled('Text',-height=>2)->pack;
for my $stresser ('a'..'zzz') {
$tw-> windowCreate('end',-window=>$tw->Button(-text=>$stresser));
if ($stresser =~ /z$/) {
$tw-> insert('end',"\n") ;
$tw-> seeEnd;
$tw-> update;
}
}
my $t1=time;
print STDERR "time=".($t1-$t0)."\n";
MainLoop;
it occures that approximately after 1000th insertion of widget further
insertions are visually slower, and then slower yet, and slower and slower.
However, when changing a line in Tcl::Tk::declare_widget sub
my $id = $path=~/^\./ ? $int-> invoke('winfo','id',$path) : $path;
to
my $id = $path;
it appears no slowness.
Changing this way results in changing some internal logic, but all other
things remains functional (including -d:tcltkdb, which has multiple
interpreters)
So I am going to do this change.
Also, I am going to commit few other small speed improvements:
- declare_widget now takes additional 3rd argument, which package
widget should be blessed to. (otherwise there were more consequent
blesses: first into Tcl::Tk::Widget, and then, say, into
Tcl::Tk::Widget::Text)
- $gwcnt incremented every time widget path is invented, so
simplifying logic and making it faster.
Vadim.
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Tcltk-perl mailing list
Tcltk-perl@[...].net
https://lists.sourceforge.net/lists/listinfo/tcltk-perl
|