[Koha-bugs] [Bug 32060] Improve performance of Koha::Item->columns_to_str
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu May 11 18:28:17 CEST 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32060
--- Comment #11 from David Gustafsson <glasklas at gmail.com> ---
This actually speeds speeds up so that calling the property method directly is
as fast as$self->_result()->get_column($column)
if ( grep { $_ eq $method } @columns ) {
# if ( @_ ) {
# $self->_result()->set_column( $method, @_);
# return $self;
#} else {
# my $value = $self->_result()->get_column( $method );
# return $value;
#}
no strict 'refs';
*{$AUTOLOAD} = sub {
my $self = shift;
if ( @_ ) {
$self->_result()->set_column( $method, @_);
return $self;
} else {
my $value = $self->_result()->get_column( $method );
return $value;
}
};
This lazily defined new methods in the symbol table, and next time that method
will be called instead of AUTOLOAD. Will have a look at creating another bug
for this change.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list