jQuery animate vs css
JavaScript performance comparison
Info
Test, how much slower jQuery animate is in comparison of setting the width with css
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style type="text/css">#test{width:0px;display:inline;height:50px;}</style>
<div id="test">
</div>
<script>
Benchmark.prototype.setup = function() {
var percent = 100, i=0, step = 10, $div = $("#test");
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
jQuery animate |
|
pending… |
jQuery css width |
|
pending… |
jQuery css width as key-value |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments