Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 30929
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: mattias.j.andersson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Balloon performance problem in 804.0275
Date: Fri, 23 Nov 2007 10:38:54 +0100
To: bug-Tk [...] rt.cpan.org
From: "Mattias Andersson" <mattias.j.andersson [...] gmail.com>
Hi Bug-Tk, We experience Tk version 804.0275 very slow, has bad responsiveness. The problem is that a simple application containing a Tk::Balloon performs many stat system calls trying to find a module (MasterMenu.al) to auto-load. Running this program and sweeping the mouse two times over the main window result in: use strict; use warnings; use Tk; use Tk::Balloon; my $mw = MainWindow->new; my $balloon = $mw->Balloon(); my $btn = $mw->Button(-text => "Exit", -command => sub { exit }); $btn->pack(); $balloon->attach($btn, -balloonmsg => 'Balloon help message'); MainLoop; Tk Version 804.0275 ============================== ; truss -tfstat64,stat64 perl balloontest.pl | & grep MasterMenu.al | wc -l 496 ; perl -MTk -e 'print "$Tk::VERSION\n"' 804.0275 ; perl -v This is perl, v5.8.8 built for sun4-solaris-thread-multi Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. ; ; uname -a SunOS uws146 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V210 Tk Version 804.027 ============================== ; truss -tfstat64,stat64 perl balloontest.pl | & grep MasterMenu.al | wc -l 0 ; perl -MTk -e 'print "$Tk::VERSION\n"' 804.027 The problem is that in Tk::Balloon::Motion a check is performed if $client->can("MasterMenu"), because AutoLoader cant find the method (other than in Tk::Menu, I think) it try to load the module MasterMenu.al before it fails. This is performed every time the mouse is moved and one stat call is performed for each path in @INC. We have a quite big Tk application where this problem makes the application considerable slower. One workaround is to implement the Widget::MasterMenu method and simply return a false value. package Tk::Widget; sub MasterMenu { return 0; } Regards Mattias
Subject: Re: [rt.cpan.org #30929] Balloon performance problem in 804.0275
Date: 24 Nov 2007 00:02:31 +0100
To: bug-Tk [...] rt.cpan.org
From: Slaven Rezic <slaven [...] rezic.de>
"Mattias Andersson via RT" <bug-Tk@rt.cpan.org> writes: Show quoted text
> Fri Nov 23 05:07:10 2007: Request 30929 was acted upon. > Transaction: Ticket created by mattias.j.andersson@gmail.com > Queue: Tk > Subject: Balloon performance problem in 804.0275 > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: mattias.j.andersson@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=30929 > > > > Hi Bug-Tk, > > We experience Tk version 804.0275 very slow, has bad responsiveness. > The problem is that a simple application containing a Tk::Balloon > performs many stat system calls trying to find a module > (MasterMenu.al) to auto-load. > > Running this program and sweeping the mouse two times over the main > window result in: > > > use strict; > use warnings; > > use Tk; > use Tk::Balloon; > > my $mw = MainWindow->new; > > my $balloon = $mw->Balloon(); > > my $btn = $mw->Button(-text => "Exit", > -command => sub { exit }); > > $btn->pack(); > > $balloon->attach($btn, -balloonmsg => 'Balloon help message'); > > MainLoop; > > > > Tk Version 804.0275 > ============================== > > > ; truss -tfstat64,stat64 perl balloontest.pl | & grep MasterMenu.al | wc -l > 496 > > ; perl -MTk -e 'print "$Tk::VERSION\n"' > 804.0275 > > > ; perl -v > > This is perl, v5.8.8 built for sun4-solaris-thread-multi > > Copyright 1987-2006, Larry Wall > > Perl may be copied only under the terms of either the Artistic License or the > GNU General Public License, which may be found in the Perl 5 source kit. > > Complete documentation for Perl, including FAQ lists, should be found on > this system using "man perl" or "perldoc perl". If you have access to the > Internet, point your browser at http://www.perl.org/, the Perl Home Page. > > ; > > ; uname -a > SunOS uws146 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V210 > > > Tk Version 804.027 > ============================== > > ; truss -tfstat64,stat64 perl balloontest.pl | & grep MasterMenu.al | wc -l > 0 > > ; perl -MTk -e 'print "$Tk::VERSION\n"' > 804.027 > > > > The problem is that in Tk::Balloon::Motion a check is performed if > $client->can("MasterMenu"), because AutoLoader cant find the method > (other than in Tk::Menu, I think) it try to load the module > MasterMenu.al before it fails. This is performed every time the mouse > is moved and one stat call is performed for each path in @INC. > > We have a quite big Tk application where this problem makes the > application considerable slower. > > One workaround is to implement the Widget::MasterMenu method and > simply return a false value. > > package Tk::Widget; > > sub MasterMenu > { > return 0; > } > > Regards Mattias >
Can you check if you have still this problem with the current Tk version from the subversion repository: https://svn.perl.org/modules/Tk/trunk ? I just compiled and checked on this machine: $ uname -a SunOS fiesta 5.10 Generic_127111-01 sun4u sparc SUNW,Sun-Fire-880 with perl 5.8.4 and there were no statfs calls after the main window was displayed, especially no calls for MasterMenu.al. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de tkruler - Perl/Tk program for measuring screen distances http://ptktools.sourceforge.net/#tkruler
Subject: Re: [rt.cpan.org #30929] Balloon performance problem in 804.0275
Date: Mon, 26 Nov 2007 14:08:37 +0100
To: bug-Tk [...] rt.cpan.org
From: "Mattias Andersson" <mattias.j.andersson [...] gmail.com>
Hi Slaven, I tried the latest version and still have the same problem. I hope that I did everything right (I built Tk in my home directory). Did you move the mouse pointer over the main window during your test? ; truss -tfstat64,stat64 perl -I . -I sun4-solaris-thread-multi $PH/tmp/balloontest.pl | & grep MasterMenu.al | wc -l 781 ; perl -I . -I sun4-solaris-thread-multi -MTk -e 'print "$Tk::VERSION\n"' 804.027502 ; Regards Mattias
On Mon Nov 26 08:09:19 2007, mattias.j.andersson@gmail.com wrote: Show quoted text
> Hi Slaven, > > I tried the latest version and still have the same problem. I hope > that I did everything right (I built Tk in my home directory). > > Did you move the mouse pointer over the main window during your test? > > ; truss -tfstat64,stat64 perl -I . -I sun4-solaris-thread-multi > $PH/tmp/balloontest.pl | & grep MasterMenu.al | wc -l > 781 > ; perl -I . -I sun4-solaris-thread-multi -MTk -e 'print "$Tk::VERSION\n"' > 804.027502 > ; >
I can now reproduce the problem, but only with perl 5.10.0. I suspect the problem comes from a newer version of AutoLoader. What AutoLoader version is installed on your system? Regards, Slaven
Subject: Re: [rt.cpan.org #30929] Balloon performance problem in 804.0275
Date: Tue, 27 Nov 2007 07:53:11 +0100
To: bug-Tk [...] rt.cpan.org
From: "Mattias Andersson" <mattias.j.andersson [...] gmail.com>
Show quoted text
> I can now reproduce the problem, but only with perl 5.10.0. I suspect > the problem comes from a newer version of AutoLoader. What AutoLoader > version is installed on your system? >
Okay, we use: ; perl -MAutoLoader -e 'print "$AutoLoader::VERSION\n"' 5.63 In another installation where we don't see the problem we have 5.60. Regards Mattias
Subject: Re: [rt.cpan.org #30929] Balloon performance problem in 804.0275
Date: 27 Nov 2007 23:17:27 +0100
To: bug-Tk [...] rt.cpan.org
From: Slaven Rezic <slaven [...] rezic.de>
"Mattias Andersson via RT" <bug-Tk@rt.cpan.org> writes: Show quoted text
> Queue: Tk > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=30929 > >
> > I can now reproduce the problem, but only with perl 5.10.0. I suspect > > the problem comes from a newer version of AutoLoader. What AutoLoader > > version is installed on your system? > >
> > Okay, we use: > > ; perl -MAutoLoader -e 'print "$AutoLoader::VERSION\n"' > 5.63 > > In another installation where we don't see the problem we have 5.60. >
If you slightly change the "can" function in AutoLoader (adding $INC{$filename}=undef}), then the problem should go away. Though the fix is not very well tested. ###################################################################### sub can { my ($self, $method) = @_; my $parent = $self->SUPER::can( $method ); return $parent if $parent; my $package = ref( $self ) || $self; my $filename = AutoLoader::find_filename( $package . '::' . $method ); local $@; $INC{$filename} = undef, return unless eval { require $filename }; no strict 'refs'; return \&{ $package . '::' . $method }; } ###################################################################### Of course, perl5.10.0 is near and I fear that there won't be an AutoLoader fix until then, so I'll probably follow your suggestion and add a dummy MasterMenu definition to Tk::Widget. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de tktimex - time recording tool http://sourceforge.net/projects/ptktools/
Fixed in r10322