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

Unified Diff: chrome/test/data/v8_benchmark/splay.js

Issue 8749001: Upgrade V8 Benchmark from v4 to v6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/test/data/v8_benchmark/run.html ('k') | chrome/test/data/v8_benchmark/style.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/v8_benchmark/splay.js
diff --git a/chrome/test/data/v8_benchmark/splay.js b/chrome/test/data/v8_benchmark/splay.js
index 53fc72793e4255ce3164194026c7c6046a978d6f..6b4f56d3213846574ca1ac3c75a52e4ae0dcc66c 100644
--- a/chrome/test/data/v8_benchmark/splay.js
+++ b/chrome/test/data/v8_benchmark/splay.js
@@ -33,7 +33,7 @@
// also has to deal with a lot of changes to the large tree object
// graph.
-var Splay = new BenchmarkSuite('Splay', 126125, [
+var Splay = new BenchmarkSuite('Splay', 81491, [
new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown)
]);
@@ -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;
}
@@ -230,8 +231,23 @@ SplayTree.prototype.find = function(key) {
/**
+ * @return {SplayTree.Node} Node having the maximum key value.
+ */
+SplayTree.prototype.findMax = function(opt_startNode) {
+ if (this.isEmpty()) {
+ return null;
+ }
+ var current = opt_startNode || this.root_;
+ while (current.right) {
+ current = current.right;
+ }
+ return current;
+};
+
+
+/**
* @return {SplayTree.Node} Node having the maximum key value that
- * is less or equal to the specified key value.
+ * is less than the specified key value.
*/
SplayTree.prototype.findGreatestLessThan = function(key) {
if (this.isEmpty()) {
@@ -242,7 +258,7 @@ SplayTree.prototype.findGreatestLessThan = function(key) {
this.splay_(key);
// Now the result is either the root node or the greatest node in
// the left subtree.
- if (this.root_.key <= key) {
+ if (this.root_.key < key) {
return this.root_;
} else if (this.root_.left) {
return this.findMax(this.root_.left);
« no previous file with comments | « chrome/test/data/v8_benchmark/run.html ('k') | chrome/test/data/v8_benchmark/style.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698