OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 15 matching lines...) Expand all Loading... |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // This benchmark is based on a JavaScript log processing module used | 28 // This benchmark is based on a JavaScript log processing module used |
29 // by the V8 profiler to generate execution time profiles for runs of | 29 // by the V8 profiler to generate execution time profiles for runs of |
30 // JavaScript applications, and it effectively measures how fast the | 30 // JavaScript applications, and it effectively measures how fast the |
31 // JavaScript engine is at allocating nodes and reclaiming the memory | 31 // JavaScript engine is at allocating nodes and reclaiming the memory |
32 // used for old nodes. Because of the way splay trees work, the engine | 32 // used for old nodes. Because of the way splay trees work, the engine |
33 // also has to deal with a lot of changes to the large tree object | 33 // also has to deal with a lot of changes to the large tree object |
34 // graph. | 34 // graph. |
35 | 35 |
36 var Splay = new BenchmarkSuite('Splay', 21915, [ | 36 var Splay = new BenchmarkSuite('Splay', 81491, [ |
37 new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown) | 37 new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown) |
38 ]); | 38 ]); |
39 | 39 |
40 | 40 |
41 // Configuration. | 41 // Configuration. |
42 var kSplayTreeSize = 8000; | 42 var kSplayTreeSize = 8000; |
43 var kSplayTreeModifications = 80; | 43 var kSplayTreeModifications = 80; |
44 var kSplayTreePayloadDepth = 5; | 44 var kSplayTreePayloadDepth = 5; |
45 | 45 |
46 var splayTree = null; | 46 var splayTree = null; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 */ | 385 */ |
386 SplayTree.Node.prototype.traverse_ = function(f) { | 386 SplayTree.Node.prototype.traverse_ = function(f) { |
387 var current = this; | 387 var current = this; |
388 while (current) { | 388 while (current) { |
389 var left = current.left; | 389 var left = current.left; |
390 if (left) left.traverse_(f); | 390 if (left) left.traverse_(f); |
391 f(current); | 391 f(current); |
392 current = current.right; | 392 current = current.right; |
393 } | 393 } |
394 }; | 394 }; |
OLD | NEW |