lively.lang benchmarks
run
apps.benchmark
browse
load now
is loaded
ModulePart
X
M

Workspace
X
M

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var arr = apps.benchmark.Helper.createRandomArray(10000);
ArrayBenchmarks = {
    // performance of basic array methods:
    "Array - basic": {
        "for"function() {
            var result = 0;
            for (var i = 0; i < arr.length; i++) {
                result += arr[i];
            }
            return result;
        },
        "for - static"function() {
            var result = 0;
            for (var i = 0, len = arr.length; i < len; i++) {
                result += arr[i];
            }
            return result;
        },
        "each"function() {
            var result = 0;
            arr.each(function(n) { result += n });
            return result;
        },
        "forEach"function() {
            var result = 0;
            arr.forEach(function(n, i) { result += n + i });
            return result;
        },
        "all"function() {
            return arr.all(function(n) { return n < 101; });
        },
        "any"function() {
            return arr.any(function(n) { return n > 101; });
        },
        "detect"function() {
            return arr.detect(function(n, i) { return i > arr.length; });
        },
        "collect"function() {
            return arr.collect(function(n, i) { return n.toString(); });
        },
        "map"function() {
            return arr.map(function(n, i) { return n.toString(); });
        },
        "include"function() {
            return arr.include(101);
        },
        "invoke"function() {
            return arr.invoke('toString');
        },
        "groupBy"function() {
            return arr.groupBy(function(n) { return n });
        }
    },
X
after optimization (rev 169249): Array>>each: 1720 ops/s 0.57 ms Array>>forEach: 1710 ops/s 0.59 ms Array>>all: 3216 ops/s 0.31 ms Array>>detect: 793 ops/s 1.22 ms Array>>collect: 1376 ops/s 0.72 ms Array>>include: 16080 ops/s 0.06 ms Array>>invoke: 569 ops/s 1.76 ms Array>>groupBy: 2627 ops/s 0.38 ms
before optimizations: Array>>each: 1216 ops/s 0.8 ms Array>>forEach: 1743 ops/s 0.57 ms Array>>all: 3310 ops/s 0.29 ms Array>>detect: 553 ops/s 1.69 ms Array>>collect: 1366 ops/s 0.74 ms Array>>include: 12925 ops/s 0.07 ms Array>>invoke: 569 ops/s 1.74 ms Array>>groupBy: n/a
Array optimizations 2012-06-05
X
M

A newer version of Lively is available. You can safely continue to work or reload this world to get the updates.
Workspace
X
M

-= 2013-05-13 11:05:34 =-
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31 on MacIntel
Array - basic     name           ops/s   ms  
                  for            420     252 
                  for - static   820     118 
                  each           1660    61  
                  forEach        1730    77  
                  all            1770    52  
                  any            1770    52  
                  detect         720     137 
                  collect        1440    72  
                  map            1260    69  
                  include        19240   7   
                  invoke         670     144 
                  groupBy        3650    28  
Array - collect   name           ops/s   ms  
                  for            30      3200
                  forEach        770     146 
                  collect        760     131 
                  invoke         280     331 
-= 2012-09-23 13:09:16 =-
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1 on MacIntel
Array - basic     name           ops/s   ms   
                  for            390     2.68 
                  for - static   760     1.31 
                  each           1980    0.49 
                  forEach        1950    0.75 
                  all            3750    0.26 
                  any            4120    0.24 
                  detect         690     1.5  
                  collect        1470    0.65 
                  map            1590    0.62 
                  include        18270   0.05 
                  invoke         710     1.39 
                  groupBy        3030    0.32 
Array - collect   name           ops/s   ms   
X