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