How to Benchmark Javascript DOM Manipulation
问题 I have two javascript functions that do same thing: create a menu based on a json object. One function appends all the <ul> and <li> elements to a variable, and then writes the HTML to the document using the method innerHTML The second function create DOM elements through createElement("ul") and appendChild() methods So I want to know which function is faster, but I do not know how to perform a benchmark test in javascript. my first function is buildMenutoString() and the second function is