tool-navigation-improvement
JavaScript performance comparison
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="nav-tool">
</div>
<script>
Benchmark.prototype.setup = function() {
tNConf = {
skipTool: function(tool) {
return tool.name() == "search";
},
getNavElement: function(tool) {
return $("<div>", {
text: tool.title()
})
},
postbuild: new Function(),
click: function() {
contentM.openTool($(this).attr("id").split("_")[1]);
},
startTool: "apps"
}
var Tool = function(name, title, config) {
this.name = function() {
return name
}
this.title = function() {
return name
}
}
var contentMConstructor = function() {
var tools = [new Tool("apps"), new Tool("news"), new Tool("tasks"), new Tool("docs"), new Tool("profil"), new Tool("search")];
this.allTools = function() {
return tools;
}
}
var contentM = new contentMConstructor();
};
Benchmark.prototype.teardown = function() {
$(".main-tool").remove();
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
old |
|
pending… |
new |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments