Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6019)

Unified Diff: chrome/test/data/dromaeo/tests/sunspider-math-spectral-norm.html

Issue 269054: Importing dromaeo performance tests to src/chrome/test/data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/dromaeo/tests/sunspider-math-spectral-norm.html
===================================================================
--- chrome/test/data/dromaeo/tests/sunspider-math-spectral-norm.html (revision 0)
+++ chrome/test/data/dromaeo/tests/sunspider-math-spectral-norm.html (revision 0)
@@ -0,0 +1,64 @@
+<html>
+<head>
+<script src="../htmlrunner.js"></script>
+<script>
+// The Great Computer Language Shootout
+// http://shootout.alioth.debian.org/
+//
+// contributed by Ian Osgood
+
+function A(i,j) {
+ return 1/((i+j)*(i+j+1)/2+i+1);
+}
+
+function Au(u,v) {
+ for (var i=0; i<u.length; ++i) {
+ var t = 0;
+ for (var j=0; j<u.length; ++j)
+ t += A(i,j) * u[j];
+ v[i] = t;
+ }
+}
+
+function Atu(u,v) {
+ for (var i=0; i<u.length; ++i) {
+ var t = 0;
+ for (var j=0; j<u.length; ++j)
+ t += A(j,i) * u[j];
+ v[i] = t;
+ }
+}
+
+function AtAu(u,v,w) {
+ Au(u,w);
+ Atu(w,v);
+}
+
+function spectralnorm(n) {
+ var i, u=[], v=[], w=[], vv=0, vBv=0;
+ for (i=0; i<n; ++i) {
+ u[i] = 1; v[i] = w[i] = 0;
+ }
+ for (i=0; i<10; ++i) {
+ AtAu(u,v,w);
+ AtAu(v,u,w);
+ }
+ for (i=0; i<n; ++i) {
+ vBv += u[i]*v[i];
+ vv += v[i]*v[i];
+ }
+ return Math.sqrt(vBv/vv);
+}
+
+window.onload = function(){ startTest("sunspider-math-spectral-norm", '');
+
+test( "Spectral Norm", function(){
+ for (var i = 12; i <= 24; i *= 2)
+ spectralnorm(i);
+});
+
+endTest(); };
+</script>
+</head>
+<body></body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698