Prototype setStyle performance

Benchmark created by Christopher on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
<div id="foo">foobar text.</div>
<script>
  window.foo = $("foo");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
setStyle string
foo.setStyle("opacity: 0.5; position: relative; right: -5px; z-index: 100; height: 100px; padding: 10px; color: red;");
ready
setStyle object
foo.setStyle({
 opacity: 0.5,
 position: "relative",
 right: "-5px",
 zIndex: "100",
 height: "100px",
 padding: "10px",
 color: "red"
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Christopher on