Univention Bugzilla – Bug 45076
UMC freezes when the search in package management module returns too many results
Last modified: 2018-01-29 17:13:58 CET
I made a search for every package (with *) and the UMC froze. There were 48736 packages in the search result and the UMC froze for approximately 1 minute. (chromium browser) In Firefox I at least got a message that a script is not responding. The unresponsive script was this line from umc/widgets/Grid.js: return a.localeCompare(b, kernel.locale, {numeric: true}) < 0; // some context var compare = function(aValue, bValue) { var a = sortFormatter(aValue); var b = sortFormatter(bValue); if (typeof(a.localeCompare) === 'function') { return a.localeCompare(b, kernel.locale, {numeric: true}) < 0; } else if (typeof(a.toLowerCase) === 'function') { return a.toLowerCase() < b.toLowerCase(); } else { return a < b; } };
Could this be a regression by Bug #44431?
(In reply to Florian Best from comment #1) > Could this be a regression by Bug #44431? It's bug 44361 :( The localeCompare function I used is a lot slower than I expected... I'm looking into alternatives. The easiest solution might be to check how many entries we need to sort and not using locale aware sorting for more than X entries.
Created attachment 9065 [details] proposed patch The patch uses a pre initialized Intl.Collator object (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) which speeds up the comparison significantly. Times for sorting 48736 packages: intlCollator.compare(a, b): 571ms a.toLowerCase() < b.toLowerCase(): 231ms a < b: 87ms MDN suggests sorting with a map: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort But I think that would need quite a bit of time and effort to implement.
*** Bug 45624 has been marked as a duplicate of this bug. ***
4.2-3: b890537e 47f2d0d7 849c12c0 90b67e51 7d65e151: YAML 4.3-0: 89d875ef 9350e992 1d5a065f 1e8826bd
OK Code OK Sorting of 50.000 grid entries now takes < 1s OK Sorting with undefined/null values inbetween still works ~OK Sorting a column where every value is the same (e.g. path in users) sorts arbitrarily. see Bug #44690 OK Merge OK YAML (bd61598) -> verified
<http://errata.software-univention.de/ucs/4.2/271.html>