Click here to get back home

Re: Devel::SmallProf claims "return 1" needs much time !?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: Devel::SmallProf claims "return 1" needs much time !? xhoster 04-30-2008
Posted by Wolfram Humann on May 1, 2008, 9:07 am
Please log in for more thread options
On 30 Apr., 23:52, xhos...@gmail.com wrote:
>
> I'm not sure, but I think that by restricting your packages that way, all
> the time spent in a non-monitored package will get attributed to the
> most recently executed statement which is in one of the monitored packages=
.
> That statement is likely to be a "return".

I never thought of that but it sounds quite possible. Thanks for the
hint.

> It looks like DBM::Deep is trying to change from a module to tie hashes to=

> disk with as little differences as possible (behvior-wise) from a regular
> Perl hash; and instead turn into a full-fledged ACID database. =A0I think
> that that is unfortunate. =A0Perhaps a code fork is in order.

I rather think that during the major rework to version 1.000 a few
things got introduced that make the module unnecessary slow. I posted
here http://groups.google.com/group/DBM-Deep/browse_thread/thread/9ae2ae3013=
0a49f7
what I think is one major problem. I would appreciate comments if you
have the time to look into that.

If my profiling results are worth anything, code like "sub engine
{ $_[0] }" (in Engine.pm) is also a bad idea because it's
called so often. And then "$e =3D $self->engine" is just two characters
less than "$e =3D $self->" and probably much slower. But I still
need to ask Rob Kinyon if there are any reasons I don't know for these
subs.

Wolfram

Posted by xhoster on May 2, 2008, 6:07 pm
Please log in for more thread options
> On 30 Apr., 23:52, xhos...@gmail.com wrote:
> >
> > I'm not sure, but I think that by restricting your packages that way,
> > all the time spent in a non-monitored package will get attributed to
> > the most recently executed statement which is in one of the monitored
> > packages=
> .
> > That statement is likely to be a "return".
>
> I never thought of that but it sounds quite possible. Thanks for the
> hint.

And I've verified that this is indeed the case.

>
> > It looks like DBM::Deep is trying to change from a module to tie hashes
> > to disk with as little differences as possible (behvior-wise) from a
> > regular Perl hash; and instead turn into a full-fledged ACID database.
> > I think that that is unfortunate. Perhaps a code fork is in
> > order.
>
> I rather think that during the major rework to version 1.000 a few
> things got introduced that make the module unnecessary slow. I posted
> here
> http://groups.google.com/group/DBM-Deep/browse_thread/thread/9ae2ae3013=
> 0a49f7 what I think is one major problem. I would appreciate comments if
> you have the time to look into that.

It looks like your proposed change should work, unless $orig_loc or
$old_loc are objects with operator overloading, which doesn't seem to be
the case. (But I do have to wonder why it was done the way it was in the
first place. It is certainly an oddly contorted way of doing things if it
wasn't done like that for a reason.)

Anyway, I ran the self-tests that come with DBM-Deep with your proposed
change in place and it passes all tests, so I'd call it good. And it does
make it much faster, but as you note, it still isn't all that speedy.
Reverting back to DBM version 0.983 is 20 times faster than even your
improved version.

>
> If my profiling results are worth anything, code like "sub engine
> { $_[0] }" (in Engine.pm) is also a bad idea because it's
> called so often. And then "$e =3D $self->engine" is just two characters
> less than "$e =3D $self->" and probably much slower. But I still
> need to ask Rob Kinyon if there are any reasons I don't know for these
> subs.

That is classic OO programming to support inheritance. Some subclass might
want to override engine(), which of course it can't do if
"$e = $self->" is used instead of "$e = $self->engine"

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Similar ThreadsPosted
Devel::StackTrace November 16, 2006, 10:35 am
Devel::Cover How to get a more indepth report January 10, 2007, 7:19 pm
Profiling Perl with better granularity than Devel::DProf October 8, 2007, 5:22 pm
GMT time to local time, according to timezone and summer/winter time. May 15, 2005, 10:45 pm
Calculating time of employee session from the log date/time stampusing perl May 24, 2005, 5:55 pm
How do I convert TIME into Cookie and last-modified-time format? October 1, 2004, 3:05 pm
Compare UNIX file time with time in a variable November 23, 2006, 2:39 pm
How to send a query to the browser from time to time? July 20, 2005, 9:35 am
Time::Format with two $time strings February 23, 2005, 4:56 pm
Perl time and Mysql time September 26, 2005, 7:47 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap