Closed LukeWoodward closed 7 years ago
I'm going to close this issue without any changes being required.
I saw a small performance improvement when building up the results table using an HTML string, but not as significant as I had hoped. I don't feel the small performance increase is worth the effort of making this change.
I've tried to develop SplitsBrowser without using any HTML manipulation. Text and elements are added to the page by using DOM methods, or at least D3 wrappers around them. For one thing, this prevents any script-injection nastiness. If a competitor should have a 'malicious' name such as <script>alert('XSS!');</script>
, then the HTML in this name will never be interpreted as HTML and the script will never get executed. Building the results table using HTML would go against this.
I also tried a similar approach which reused existing table rows instead of removing and recreating the lot. That also had no significant performance increase either.
After further thought I've decided to reopen this one.
There's another way to do this, and that is to build up the HTML in an array of strings, and then join
the lot of them up and assign to the innerHTML of an element. Building the lot up into one HTML string is subject to Schlemiel-the-painter-esque performance problems.
The results table page can seem quite slow to load at times, and this is particularly noticeable if you navigate to the results table page and change class.
This StackOverflow question suggests that it may be quicker to build the table up by assigning to the innerHTML of an element than by using DOM manipulation. This approach should therefore be investigated to see if it can improve the performance of the results table.