[Koha-bugs] [Bug 30359] GetBudgetHierarchy is slow on order receive page
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Mar 30 07:08:19 CEST 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30359
--- Comment #3 from Johanna Räisä <johanna.raisa at koha-suomi.fi> ---
(In reply to Nick Clemens from comment #2)
> One this page we are calling GetBudgetHierarchy in a loop on al the budget
> periods - this seems to be extra work.
>
> Compare this to the way things are handled in neworderempty.pl:
> 333 my $budget = GetBudget($budget_id);
> 334 # build budget list
> 335 my $budget_loop = [];
> 336 my $budgets = GetBudgetHierarchy;
> 337 foreach my $r (@{$budgets}) {
> 338 next unless (CanUserUseBudget($patron, $r, $userflags));
> 339 push @{$budget_loop}, {
> 340 b_id => $r->{budget_id},
> 341 b_txt => $r->{budget_name},
> 342 b_sort1_authcat => $r->{'sort1_authcat'},
> 343 b_sort2_authcat => $r->{'sort2_authcat'},
> 344 b_active => $r->{budget_period_active},
> 345 b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
> 346 b_level => $r->{budget_level},
> 347 };
> 348 }
>
> I think we have other occurrences as well - we should consolidate this code
> and make the dropdowns work the same
>
> I am not against removing the totals, but I think the loop in the script is
> the bigger culprit here
Yes, there might be other occurrences which need optimization too. When I
investigated the culprit the loop didn't stand out. The real affect came from
skipping the calculations. The improvement was huge, the waiting time was first
1.89 minutes and after this patch it went to 460ms.
If some places we are using only part of what GetBudgetHierarchy offers, would
it be a good idea make separate functions?
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list