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

Generate less DOM nodes #78

Open
arneg opened this issue Apr 17, 2016 · 3 comments
Open

Generate less DOM nodes #78

arneg opened this issue Apr 17, 2016 · 3 comments

Comments

@arneg
Copy link
Member

arneg commented Apr 17, 2016

In many widgets like circular, DOM nodes are created but are often left empty, like markers, dots, etc. Create those nodes dynamically when they are needed. They increase the size of the DOM and thereby the cost of relayouts.

@arneg
Copy link
Member Author

arneg commented Apr 17, 2016

Here are some statistics of the 64 channel demo. Whats measured here is a timeline profile for setting a random value to a knob 100 times. The difference with the measurements is number of strips and number of pages.

Safari (MacBook Pro)

1 Strip and 1 Page

1s1p

8 Strips and 1 Page

8s1p

8 Strips and 8 Pages

8s8p

8 Strips and 8 Pages (all pages preloaded)

8s8p nd

8 Strips and 8 Pages (no preload, no DOM)

pages removed from dom, instead of 'display:none'
8s8p nd np

8 Strips and 8 Pages (no preload)

8s8p np

Chrome (MacBook Pro)

1 Strip and 1 Page

c 1s1p

8 Strips and 1 Page

c 8s1p

8 Strips and 8 Pages

c 8s8p 2

8 Strips and 8 Pages (no DOM)

c 8s8p nd

8 Strips and 8 Pages (no preload)

c 8s8p np

8 Strips and 8 Pages (no preload, no DOM)

c 8s8p np nd

Firefox (MacBook Pro)

1 Strip and 1 Page

f 1s1p

8 Strips and 1 Page

f 8s1p

8 Strips and 8 Pages

f 8s8p

8 Strips and 8 Pages (no DOM)

f 8s8p nd

8 Strips and 8 Pages (no DOM, no preload)

f 8s8p nd np

8 Strips and 8 Pages (no preload)

f 8s8p np

Microsoft Edge

legende

1 Strip 1 Page

e 1s1p

8 Strips 1 Page

e 8s1p

8 Strips 8 Pages

e 8s8p

8 Strips 8 Pages (no DOM)

e 8s8p nd

8 Strips 8 Pages (no preload)

e 8s8p np

Safari (iPad)

1 Strip 1 Page

ik 1s1p

8 Strips 1 Page

ik 8s1p

8 Strips 8 Page

ik 8s8p

8 Strips 8 Page (no preload)

ik 8s8p np

@arneg
Copy link
Member Author

arneg commented Apr 17, 2016

As a comparison a similar benchmark with one levelmeter, which uses a canvas does not touch the DOM.

Safari (MacBook Pro)

1 Strip 1 Page

fd 1s1p

8 Strips 1 Page

fd 8s1p

8 Strips 8 Pages (no preload)

fd 8s8p

8 Strips 8 Pages

fd 8s8p preload

@boomshop
Copy link
Member

I guess best way to fix is to still create the nodes but not to add them to the DOM if unused - or remove them from the DOM if emptied. Those nodes are an inherent part of a widget and should be available anytime - whether or not currently added to the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants