performance problem

performance problem

am 26.11.2007 21:01:13 von anon24u

Hi,

My workstation was recently upgraded to Fedora 8, and this has wreaked
havoc on the performance of my perl application. I did a profile on
the code and the problem appears to be within Scalar::Util. The thing
is, I don't know what to do next... The code below used to take about
2s to run, now it is several minutes! I use the Class::Std
infrastructure, and that is generating the 320k calls to refaddr, but
the same code producing the same number of calls runs in a couple
seconds on an older workstation.

Any suggestions?

[ollivier@samba anc]$ dprofpp
Total Elapsed Time = 328.8558 Seconds
User+System Time = 308.8358 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
94.5 292.0 299.49 320314 0.0009 0.0009 Scalar::Util::refaddr
2.00 6.188 7.447 320314 0.0000 0.0000 Scalar::Util::blessed
0.72 2.210 139.71 166666 0.0000 0.0008 Class::Std::__ANON__
0.48 1.488 113.10 2138 0.0007 0.0529 Class::Std::new
0.41 1.259 1.259 320314 0.0000 0.0000
UNIVERSAL::a_sub_not_likely_to_be_
here


Thanks

Re: performance problem

am 26.11.2007 22:41:55 von smallpond

On Nov 26, 3:01 pm, Gizbo wrote:
> Hi,
>
> My workstation was recently upgraded to Fedora 8, and this has wreaked
> havoc on the performance of my perl application. I did a profile on
> the code and the problem appears to be within Scalar::Util. The thing
> is, I don't know what to do next... The code below used to take about
> 2s to run, now it is several minutes! I use the Class::Std
> infrastructure, and that is generating the 320k calls to refaddr, but
> the same code producing the same number of calls runs in a couple
> seconds on an older workstation.
>
> Any suggestions?
>
> [ollivier@samba anc]$ dprofpp
> Total Elapsed Time = 328.8558 Seconds
> User+System Time = 308.8358 Seconds
> Exclusive Times
> %Time ExclSec CumulS #Calls sec/call Csec/c Name
> 94.5 292.0 299.49 320314 0.0009 0.0009 Scalar::Util::refaddr
> 2.00 6.188 7.447 320314 0.0000 0.0000 Scalar::Util::blessed
> 0.72 2.210 139.71 166666 0.0000 0.0008 Class::Std::__ANON__
> 0.48 1.488 113.10 2138 0.0007 0.0529 Class::Std::new
> 0.41 1.259 1.259 320314 0.0000 0.0000
> UNIVERSAL::a_sub_not_likely_to_be_
> here
>
> Thanks

what were the old and new versions of perl?
perl --version
This is perl, v5.8.8 built for i386-linux-thread-multi

also, versions for Scalar::Util?
perl -e 'use Scalar::Util; print $Scalar::Util::VERSION;'
1.19

Why use Class::Std? The justification is to prevent users
of your code from accessing the private fields of the classes, but
how is that your problem? If users of a package bypass the approved
methods and a change breaks their program, well, they were warned.
I'm not a fan of forcing people to do things my way, but maybe you
have good reasons.

Also, there is a tiny chance that there could be something wrong
in your code. I know that the possibility is vanishingly small,
but you might post a snippet showing the problem just to set our
minds at rest.
--S

Re: performance problem

am 26.11.2007 23:19:58 von Ben Morrow

Quoth Gizbo :
>
> My workstation was recently upgraded to Fedora 8, and this has wreaked
> havoc on the performance of my perl application. I did a profile on
> the code and the problem appears to be within Scalar::Util.

We've had reports before of Fedora 8 machines ending up with the
pure-perl version of Scalar::Util. Try running

perl -MScalar::Util=dualvar -e1

; if it fails you need to reinstall Scalar::Util, first making sure you
have a C compiler installed.

> UNIVERSAL::a_sub_not_likely_to_be_here

Yes, this is your problem. This sub is a slightly nasty artefact of the
pure-Perl implementation.

Ben

Re: performance problem

am 27.11.2007 01:59:17 von anon24u

On Nov 26, 5:19 pm, Ben Morrow wrote:
> Quoth Gizbo :
>
>
>
> > My workstation was recently upgraded to Fedora 8, and this has wreaked
> > havoc on the performance of my perl application. I did a profile on
> > the code and the problem appears to be within Scalar::Util.
>
> We've had reports before of Fedora 8 machines ending up with the
> pure-perl version of Scalar::Util. Try running
>
> perl -MScalar::Util=dualvar -e1
>
> ; if it fails you need to reinstall Scalar::Util, first making sure you
> have a C compiler installed.
>
> > UNIVERSAL::a_sub_not_likely_to_be_here
>
> Yes, this is your problem. This sub is a slightly nasty artefact of the
> pure-Perl implementation.
>
> Ben

Thanks, I was halfway there already (I figured out that something
related to XS was missing and it wasn't supposed to run the perl
implementation). Your confirms indeed that this is the problem.
Thanks!!!

Now I am trying to figure out how to reinstall Scalar::Util. Can I do
this with cpan -i somehow?

Re: performance problem

am 27.11.2007 02:01:03 von anon24u

On Nov 26, 5:19 pm, Ben Morrow wrote:
> Quoth Gizbo :
>
>
>
> > My workstation was recently upgraded to Fedora 8, and this has wreaked
> > havoc on the performance of my perl application. I did a profile on
> > the code and the problem appears to be within Scalar::Util.
>
> We've had reports before of Fedora 8 machines ending up with the
> pure-perl version of Scalar::Util. Try running
>
> perl -MScalar::Util=dualvar -e1
>
> ; if it fails you need to reinstall Scalar::Util, first making sure you
> have a C compiler installed.
>
> > UNIVERSAL::a_sub_not_likely_to_be_here
>
> Yes, this is your problem. This sub is a slightly nasty artefact of the
> pure-Perl implementation.
>
> Ben

This is what I get:

[me@hostname]$ perl -MScalar::Util=dualvar -e1
is only avaliable with the XS version at -e line 0
BEGIN failed--compilation aborted.

Re: performance problem

am 27.11.2007 04:00:20 von Ben Morrow

Quoth Gizbo :
>
> Thanks, I was halfway there already (I figured out that something
> related to XS was missing and it wasn't supposed to run the perl
> implementation). Your confirms indeed that this is the problem.
> Thanks!!!
>
> Now I am trying to figure out how to reinstall Scalar::Util. Can I do
> this with cpan -i somehow?

perl -MCPAN -e'install Scalar::Util'

or

cpan -i Scalar::Util

should do it. It may ask you some questions first: except for the one
about which CPAN mirror to use (which you should answer as best you can)
and the questions about sudo if you need it, the default answers are all
fine. Note that you will need to test again afterwards to make sure you
got the XS version this time: S::U carefully installs the pure-Perl
version if it can't find your C compiler, so whatever went wrong last
time it was installed may happen again.

Ben

Re: performance problem

am 27.11.2007 18:22:47 von anon24u

>
> perl -MCPAN -e'install Scalar::Util'
>
> or
>
> cpan -i Scalar::Util
>
> should do it. It may ask you some questions first: except for the one

Thanks Ben. I basically did that except I had to "force install"
because cpan found that the module was up-to-date.

For anyone with the same problem, there is a more focused post on this
problem here:

http://groups.google.ca/group/comp.lang.perl.misc/browse_thr ead/thread/b198594762a1039a?hl=en#