Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of toggle is expensive #79

Open
edwh opened this issue Jul 11, 2017 · 0 comments
Open

Use of toggle is expensive #79

edwh opened this issue Jul 11, 2017 · 0 comments

Comments

@edwh
Copy link

edwh commented Jul 11, 2017

This is on v1.1.2. When you render a model view, you call toggle to make sure that it's shown/hidden correctly based on any filter. My profiling on Chrome suggests that this is a bit of a performance hog, and you only really need to do it if the filter has indicated that you should hide it. Putting an if speeds things up a bit.

            if (hideThisModelView) {
                if( thisModelViewWrapped.children().length === 1 )
                    thisModelViewWrapped.toggle( ! hideThisModelView );
                else modelView.$el.toggle( ! hideThisModelView );
            }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant