Subject: | moved checking for existing _hierarchy of into DEST (patch) |
Date: | Mon, 19 May 2008 02:06:39 +0200 |
To: | bug-Class-Std [...] rt.cpan.org |
From: | MKUTTER <MKUTTER [...] cpan.org> |
Hi Dan,
Class::Std's DESTROY uses a call to _hierarchy_of() to determine the
inheritance hierarchy of a class.
However, when _hierarchy_of is called a second time, a cached value is
returned. As the %_hierarchy of hash is defined with package scope, this
results in an extraneous method call for the second and all subsequent
objects of a class being destroyed.
The attached patch addes a test for the existance of a entry in %
_hierarchy_of to DESTROY to avoid unneccessary method calls during
destruction.
A quick benchmark (also attached) shows around 10% speed gain.
Sorry for me being to stupid to email directly via git,
Martin
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.