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:
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 ) 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!
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?
Viewing 2 posts - 1 through 2 (of 2 total)
The topic ‘Improving Chrome performance’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users