Added a random JS benchmark.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 02:34:01 +0000 (02:34 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Mar 2007 02:34:01 +0000 (02:34 +0000)
        * misc/morph.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20303 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitSite/ChangeLog
WebKitSite/misc/morph.html [new file with mode: 0644]

index 8435dd284640d1f963075dc52e9136efc64e13d9..60326fb8dd49ff9fb73bb630286ad192bc41e6bc 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-18  Maciej Stachowiak  <mjs@apple.com>
+
+        Added a random JS benchmark.
+
+        * misc/morph.html: Added.
+
 2007-03-14  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by .
diff --git a/WebKitSite/misc/morph.html b/WebKitSite/misc/morph.html
new file mode 100644 (file)
index 0000000..5578a7a
--- /dev/null
@@ -0,0 +1,37 @@
+<HTML>
+<HEAD>
+<TITLE>Mesh Transfrom</TITLE>
+</HEAD>
+<BODY>
+<h1>Mesh Transfrom Benchmark</h1>
+<SCRIPT>
+var loops = 60
+var nx = 120
+var nz = 120
+
+function morph(a,f) {
+    var PI2nx = Math.PI * 8/nx
+    var sin = Math.sin
+    var f30 = -(50 * sin(f*Math.PI*2))
+    
+    for (var i = 0; i < nz; ++i) {
+        for (var j = 0; j < nx; ++j) {
+            a[3*(i*nx+j)+1]    = sin((j-1) * PI2nx ) * -f30
+        }
+    }
+}
+
+    
+var a = Array()
+for (var i=0; i < nx*nz*3; ++i) a[i] = 0
+
+var startTime=new Date() ;
+for (var i = 0; i < loops; ++i) {
+    morph(a, i/loops)
+}
+var endTime=new Date() ;
+
+document.write("Result is "+(endTime-startTime)+" ms")
+</SCRIPT>
+</HTML>
+