Opened 2 years ago

Closed 2 years ago

#14682 closed bug (fixed)

High CPU Usage on chrome/mac because of tooltips

Reported by: mani902 Owned by:
Priority: minor Milestone: none
Component: ui.tooltip Version: 1.11.3
Keywords: Cc:
Blocked by: Blocking:

Description

As part of implementing jQuery UI Tooltip library for our case, we noticed a very significant increase in CPU usage on chrome on mac. Using the chrome profiling tools, we found out

// Handle tracking tooltips that are shown with a delay (#8644). As soon
		// as the tooltip is visible, position the tooltip using the most recent
		// event.
		if ( this.options.show && this.options.show.delay ) {
			delayedShow = setInterval(function() {
				if ( tooltip.is( ":visible" ) ) {
					position( positionOption.of );
					clearInterval( delayedShow );
				}
			}, $.fx.interval );
		}

piece of code is setting timers and it increased the CPU usage by 40-50 % on some machines. Looking at the original ticket, this was related to handle the tracking tooltips with delay option. However, there is no check for the track option before setting the timer, and we are not using track=true tooltips in our case, only delay. So unknowingly using delay is causing a huge amount of cpu usage.

First fix is to add the check for the track option also, so that unless someone is not using both track and delay option, timers should not be set. Second will be to identify why the cpu usage increases so much on mac/chrome combination.

Change History (1)

comment:1 Changed 2 years ago by Mani Mishra

Resolution: fixed
Status: newclosed

Tooltip: Use show.delay update only when track option is active

Fixes #14682 Closes gh-1613

Changeset: d5732327078709c3680385c79a2106f263009f84

Note: See TracTickets for help on using tickets.