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

Unified Diff: benchmarks/splay.js

Issue 2836031: Update the V8 benchmark suite with the following fixes:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « benchmarks/run.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: benchmarks/splay.js
===================================================================
--- benchmarks/splay.js (revision 4958)
+++ benchmarks/splay.js (working copy)
@@ -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', 21915, [
new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown)
]);
@@ -231,8 +231,23 @@
/**
+ * @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()) {
@@ -243,7 +258,7 @@
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 | « benchmarks/run.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698