Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.126.2.16 -r1.126.2.17 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 30 Mar 2021 15:41:18 -0000 1.126.2.16 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 2 Nov 2021 10:29:05 -0000 1.126.2.17 @@ -1856,35 +1856,33 @@ Example: @param version_name_1 the first version name - @param version_name_2 the second version name - @return @author Lars Pind } { - db_1row select_sortable_versions {} - return [string compare $sortable_version_1 $sortable_version_2] + # + # This function is stable (returns always the same results for the + # same input) and called with only a few different input + # values. By using acs::per_thread_cache the performance improves + # from 265 microseconds to 2 microseconds; + # + return [acs::per_thread_cache eval -key acs-tcl.apm_version_names_compare($version_name_1,$version_name_2) { + db_1row select_sortable_versions {} + string compare $sortable_version_1 $sortable_version_2 + }] } ad_proc -private apm_upgrade_logic_compare {