performance problem

G

Gizbo

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
 
S

smallpond

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
 
B

Ben Morrow

Quoth Gizbo said:
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
 
G

Gizbo

Quoth Gizbo <[email protected]>:




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.


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?
 
G

Gizbo

Quoth Gizbo <[email protected]>:




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.


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.
 
B

Ben Morrow

Quoth Gizbo said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Profiling using DProf 2
DProf %time ? 1
Performance of SyncEnumerator 3

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top