Bugzilla – Attachment 157945 Details for
Bug 28410
[Omnibus] Reduce memory footprint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28410: Use lazy loading to reduce memory footprint of C4/Context.pm
Bug-28410-Use-lazy-loading-to-reduce-memory-footpr.patch (text/plain), 2.35 KB, created by
Blou
on 2023-10-26 18:10:21 UTC
(
hide
)
Description:
Bug 28410: Use lazy loading to reduce memory footprint of C4/Context.pm
Filename:
MIME Type:
Creator:
Blou
Created:
2023-10-26 18:10:21 UTC
Size:
2.35 KB
patch
obsolete
>From 90fd7322722f53d2b090eef1a3a02a6f2c5ee6a4 Mon Sep 17 00:00:00 2001 >From: Blou <blou@inlibro.com> >Date: Wed, 25 Oct 2023 16:54:08 -0400 >Subject: [PATCH] Bug 28410: Use lazy loading to reduce memory footprint of > C4/Context.pm > >This simply removes some 'use' declarations at the top of the file to >instead use 'require' later on. > >The effect can be validated with a simple one-liner (provided KOHA_CONF >and PERL5LIB being set) > >perl -e "use C4::Context; while(1){sleep(1);}" > >And monitoring the memoring usage in tools like 'top' >--- > C4/Context.pm | 8 ++++---- > C4/Search.pm | 1 + > 2 files changed, 5 insertions(+), 4 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 091e4783a4..0d8bce7458 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -36,12 +36,8 @@ BEGIN { > }; > > use Carp qw( carp ); >-use DateTime::TimeZone; > use Encode; > use File::Spec; >-use POSIX; >-use YAML::XS; >-use ZOOM; > use List::MoreUtils qw(any); > > use Koha::Caches; >@@ -342,6 +338,7 @@ the value cannot be properly decoded as YAML. > sub yaml_preference { > my ( $self, $preference ) = @_; > >+ require YAML::XS; > my $yaml = eval { YAML::XS::Load( Encode::encode_utf8( $self->preference( $preference ) ) ); }; > if ($@) { > warn "Unable to parse $preference syspref : $@"; >@@ -607,6 +604,7 @@ sub _new_Zconn { > my $user = $serverinfo->{user}; > my $password = $serverinfo->{password}; > eval { >+ require ZOOM; > # set options > my $o = ZOOM::Options->new(); > $o->option(user => $user) if $user && $password; >@@ -873,6 +871,7 @@ sub get_versions { > my ( %versions, $mysqlVersion ); > $versions{kohaVersion} = Koha::version(); > $versions{kohaDbVersion} = C4::Context->preference('version'); >+ require POSIX; > $versions{osVersion} = join(" ", POSIX::uname()); > $versions{perlVersion} = $]; > >@@ -904,6 +903,7 @@ sub tz { > my $self = shift; > if (!defined $context->{tz}) { > my $timezone = $context->{config}->timezone; >+ require DateTime::TimeZone; > $context->{tz} = DateTime::TimeZone->new(name => $timezone); > } > return $context->{tz}; >diff --git a/C4/Search.pm b/C4/Search.pm >index e2de36571e..6423caa60b 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -39,6 +39,7 @@ use URI::Escape; > use Business::ISBN; > use MARC::Record; > use MARC::Field; >+use ZOOM; > > our (@ISA, @EXPORT_OK); > BEGIN { >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28410
:
157875
|
157945
|
157946
|
157952
|
157953