From c590fb94d6d29fc013de5de912681075409ec959 Mon Sep 17 00:00:00 2001 From: "kasperl@chromium.org" Date: Mon, 17 May 2010 05:59:20 +0000 Subject: [PATCH] Incorporate feedback from issue 679 and issue 690 into the benchmark suite thus forming a new candidate benchmark revision: * Remove dead code from RayTrace benchmark. * Avoid repeated number-to-string conversion in Splay. Review URL: http://codereview.chromium.org/2086005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4658 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- benchmarks/README.txt | 8 ++++++++ benchmarks/base.js | 2 +- benchmarks/raytrace.js | 31 ------------------------------- benchmarks/revisions.html | 7 +++++++ benchmarks/run.html | 6 +++--- benchmarks/splay.js | 11 ++++++----- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/benchmarks/README.txt b/benchmarks/README.txt index eb759cc..8e08159 100644 --- a/benchmarks/README.txt +++ b/benchmarks/README.txt @@ -61,3 +61,11 @@ Removed duplicate line in random seed code, and changed the name of the Object.prototype.inherits function in the DeltaBlue benchmark to inheritsFrom to avoid name clashes when running in Chromium with extensions enabled. + + +Changes from Version 5 to Version 6 +=================================== + +Removed dead code from the RayTrace benchmark and changed the Splay +benchmark to avoid converting the same numeric key to a string over +and over again. diff --git a/benchmarks/base.js b/benchmarks/base.js index 67cddd2..ce30841 100644 --- a/benchmarks/base.js +++ b/benchmarks/base.js @@ -78,7 +78,7 @@ BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. -BenchmarkSuite.version = '5'; +BenchmarkSuite.version = '6 (candidate)'; // To make the benchmark results predictable, we replace Math.random diff --git a/benchmarks/raytrace.js b/benchmarks/raytrace.js index c68b038..da4d592 100644 --- a/benchmarks/raytrace.js +++ b/benchmarks/raytrace.js @@ -205,12 +205,6 @@ Flog.RayTracer.Light.prototype = { this.intensity = (intensity ? intensity : 10.0); }, - getIntensity: function(distance){ - if(distance >= intensity) return 0; - - return Math.pow((intensity - distance) / strength, 0.2); - }, - toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } @@ -420,31 +414,6 @@ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; -Flog.RayTracer.Shape.BaseShape = Class.create(); - -Flog.RayTracer.Shape.BaseShape.prototype = { - position: null, - material: null, - - initialize : function() { - this.position = new Vector(0,0,0); - this.material = new Flog.RayTracer.Material.SolidMaterial( - new Flog.RayTracer.Color(1,0,1), - 0, - 0, - 0 - ); - }, - - toString : function () { - return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; - } -} -/* Fake a Flog.* namespace */ -if(typeof(Flog) == 'undefined') var Flog = {}; -if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; -if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; - Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { diff --git a/benchmarks/revisions.html b/benchmarks/revisions.html index 99d7be4..b03aa12 100644 --- a/benchmarks/revisions.html +++ b/benchmarks/revisions.html @@ -20,6 +20,13 @@ the benchmark suite.

+

Version 6 (link)

+ +

Removed dead code from the RayTrace benchmark and changed the Splay +benchmark to avoid converting the same numeric key to a string over +and over again. +

+

Version 5 (link)

Removed duplicate line in random seed code, and changed the name of diff --git a/benchmarks/run.html b/benchmarks/run.html index ef2c186..30036b7 100644 --- a/benchmarks/run.html +++ b/benchmarks/run.html @@ -111,12 +111,12 @@ higher scores means better performance: Bigger is better!

  • Richards
    OS kernel simulation benchmark, originally written in BCPL by Martin Richards (539 lines).
  • DeltaBlue
    One-way constraint solver, originally written in Smalltalk by John Maloney and Mario Wolczko (880 lines).
  • Crypto
    Encryption and decryption benchmark based on code by Tom Wu (1698 lines).
  • -
  • RayTrace
    Ray tracer benchmark based on code by Adam Burmister (935 lines).
  • -
  • EarleyBoyer
    Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (4685 lines).
  • +
  • RayTrace
    Ray tracer benchmark based on code by Adam Burmister (904 lines).
  • +
  • EarleyBoyer
    Classic Scheme benchmarks, translated to JavaScript by Florian Loitsch's Scheme2Js compiler (4684 lines).
  • RegExp
    Regular expression benchmark generated by extracting regular expression operations from 50 of the most popular web pages (1614 lines).
  • -
  • Splay
    Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (378 lines).
  • +
  • Splay
    Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (379 lines).
  • diff --git a/benchmarks/splay.js b/benchmarks/splay.js index 53fc727..d8c8f04 100644 --- a/benchmarks/splay.js +++ b/benchmarks/splay.js @@ -46,16 +46,16 @@ var kSplayTreePayloadDepth = 5; var splayTree = null; -function GeneratePayloadTree(depth, key) { +function GeneratePayloadTree(depth, tag) { if (depth == 0) { return { array : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - string : 'String for key ' + key + ' in leaf node' + string : 'String for key ' + tag + ' in leaf node' }; } else { return { - left: GeneratePayloadTree(depth - 1, key), - right: GeneratePayloadTree(depth - 1, key) + left: GeneratePayloadTree(depth - 1, tag), + right: GeneratePayloadTree(depth - 1, tag) }; } } @@ -74,7 +74,8 @@ function InsertNewNode() { do { key = GenerateKey(); } while (splayTree.find(key) != null); - splayTree.insert(key, GeneratePayloadTree(kSplayTreePayloadDepth, key)); + var payload = GeneratePayloadTree(kSplayTreePayloadDepth, String(key)); + splayTree.insert(key, payload); return key; } -- 2.7.4