Support

Account

Home Forums Backend Issues (wp-admin) Improving Chrome performance

Helping

Improving Chrome performance

  • Hello,

    When using version 5.1.8 we’ve seen a huge performance improvement over 5.0.7 which we are currently using. What we have noticed though is that Chrome is not performing as well as Firefox and Safari. Chrome (v40) takes about 30 secs to fire the DOM load event where as Firefox and Safari loads within 10 secs.

    In acf-input.js starting on line 2891 in the get_visibility method we get this piece of code:

    
    // find better $trigger
    if( $triggers.length > 1 ) {
    	
    	$triggers.each(function(){
    		
    		// vars
    		$parent = $(this).parent();
    		
    		
    		if( $target.closest( $parent ).exists() ) {
    			
    			$trigger = $(this);
    			return false;
    		}
    
    	});
    	
    }
    

    The offending code is $target.closest( $parent ).exists(). In exists() you are checking if $(this).length > 0. From what I can see is that Chrome is much worse calculating the length (or getting an element using $target.closest( $parent )[0] for example) than other browsers (at least in this scenario).

    Running jQuery('#acf-modules .acf-field').length in the console returns 2142. So yes, we have quite a lot of fields. I’m not sure how to optimise this.

    I am happy to help if you need any help testing this. Thanks!

  • Hi @kroofy

    Sorry for the late reply. Just so you know, support is handled through emails via the support ticket submission here: http://support.advancedcustomfields.com/new-ticket/

    This forum is for general discussion between users.

    As for the issue, I’m glad to hear there is a increase in performance in 5.1.8.

    The piece of code you have highlighted is run when a sub field is being triggered by conditional logic. I agree that this is most likely a bottle neck for performance, but I am unsure as to how I can optimize it for many fields. Are you able to add in a console log within that snippet to see how many times it is run, and what data is found? Perhaps you could event console log some times to find out the speed issue?

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.