Fix big performance issue making CPU 100% when scrolling the textarea of an export of #17902 data

Data can be found on #17902 (https://github.com/phpmyadmin/phpmyadmin/issues/17902#issuecomment-1321082358)

I changed the events to not bind all the document but only the root node they needed.
Scrolling is way better now

I used chrome coverage mode to ensure the code is still called and tested it.

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2022-11-20 11:14:32 +01:00
parent 5723fe99f0
commit 87e44947a6
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -411,15 +411,15 @@ $(function () {
/**
* Bind all "fast filter" events
*/
$(document).on('click', '#pma_navigation_tree li.fast_filter button.searchClauseClear', Navigation.FastFilter.events.clear);
$(document).on('focus', '#pma_navigation_tree li.fast_filter input.searchClause', Navigation.FastFilter.events.focus);
$(document).on('blur', '#pma_navigation_tree li.fast_filter input.searchClause', Navigation.FastFilter.events.blur);
$(document).on('keyup', '#pma_navigation_tree li.fast_filter input.searchClause', Navigation.FastFilter.events.keyup);
$('#pma_navigation_tree').on('click', 'li.fast_filter button.searchClauseClear', Navigation.FastFilter.events.clear);
$('#pma_navigation_tree').on('focus', 'li.fast_filter input.searchClause', Navigation.FastFilter.events.focus);
$('#pma_navigation_tree').on('blur', 'li.fast_filter input.searchClause', Navigation.FastFilter.events.blur);
$('#pma_navigation_tree').on('keyup', 'li.fast_filter input.searchClause', Navigation.FastFilter.events.keyup);
/**
* Ajax handler for pagination
*/
$(document).on('click', '#pma_navigation_tree div.pageselector a.ajax', function (event) {
$('#pma_navigation_tree').on('click', 'div.pageselector a.ajax', function (event) {
event.preventDefault();
Navigation.treePagination($(this));
});
@ -427,18 +427,18 @@ $(function () {
/**
* Node highlighting
*/
$(document).on(
$('#pma_navigation_tree.highlight').on(
'mouseover',
'#pma_navigation_tree.highlight li:not(.fast_filter)',
'li:not(.fast_filter)',
function () {
if ($('li:visible', this).length === 0) {
$(this).addClass('activePointer');
}
}
);
$(document).on(
$('#pma_navigation_tree.highlight').on(
'mouseout',
'#pma_navigation_tree.highlight li:not(.fast_filter)',
'li:not(.fast_filter)',
function () {
$(this).removeClass('activePointer');
}