Devel::SlowBless - Perl extension for identifying code that causes bless into overloaded classes to be slow.
perl -d:SlowBless ... # initialization code that is expected to change PL_sub_generation Devel::SlowBless::start_warning(); ... # a stack backtrace will be output whenever PL_sub_generation or # PL_amagic_generation changes Devel::SlowBless::stop_warning(); # what it says. optional, obviously
This module provides functions to introspect the current value of the PL_sub_generation and the PL_amagic_generation internal perl variables, as well as a perl debugger implementation that will print out a stack trace whenever either of these variables changes. As of Perl 5.17.1, PL_amagic_generation has been removed and always returns 0.
Whenever either of these variables changes, the bless() function slows down as perl examines the entire class hierarchy recomputing the overloads that are normally cached in the stash. The penalty is paid just once for each class, but if these variables are changing frequently, and your program has deep class hierarchies with overloading, performance can suffer badly.
None by default.
Benjamin Holzman <email@example.com> Grant Street Group, Inc. <firstname.lastname@example.org>
Copyright (C) 2010-2011 by Benjamin Holzman and Grant Street Group, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.