lively.morphic interaction benchmarks
run
createMorphsForDepth = function(depth, parent, relativeBorderPt) { var bounds = parent.innerBounds(), border = bounds.extent().scaleByPt(relativeBorderPt || pt(0,0)), gridded = bounds.insetByPt(border).grid(2,2); return Grid.map(gridded, function(subBounds) { var m = lively.morphic.Morph.makeRectangle(subBounds); parent.addMorph(m); m.moveBy(border); m.applyStyle({fill: Color.random(), borderWidth: 0}); if (depth > 0) createMorphsForDepth(depth-1, m, relativeBorderPt); return m; }).flatten(); } ms = createMorphsForDepth(3, that, pt(0.03, 0.03)) that.removeAllMorphs() that.openInWorld() ms.invoke('remove') that.withAllSubmorphsDo(Functions.K).length
setup code
X
M

apps.benchmark
browse
load now
is loaded
ModulePart
X
M

How do the benchmarks work?
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
var m = $morph('BigMorph'),
    // point in the upper border of the big morph, no submorphs beneath
    point1 = m.worldPoint(m.innerBounds().center().withY(5)),
    // a point with a few morphs beneath
    point2 = m.submorphs[1].worldPoint(
        m.submorphs[1].innerBounds().center().addXY(15, -15));
Benchmarks = {
    // halo create / interact performance:
    "halos and menus": {
        "show and remove halo items"function() {
            m.showHalos();
            m.removeHalos();
        },
        "open and close morph menu"function() {
            var openEvt = lively.morphic.EventSimulator.createMouseEvent(
                'mousedown', point1, 2, []);
            m.showMorphMenu(openEvt);
            var closeEvt = lively.morphic.EventSimulator.createMouseEvent(
                'mousedown', pt(0,0), 0, []);
            $world.hands[0].removeOpenMenu(closeEvt);
        }
    },
    // bounding box related:
    "bounds": {
        "bounds()"function() {
            return m.withAllSubmorphsDo(function(ea) { return ea.bounds() });
X
Workspace
X
M

-= 2013-05-13 10:05:30 =-
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
halos and menus   name                         ops/s   ms    
                  show and remove halo items   30      3200  
                  open and close morph menu    30      4500  
bounds            name                         ops/s   ms    
                  bounds()                     3660    25    
drag and grab     name                         ops/s   ms    
                  drag                         10      138750
                  grab                         10      124450
-= 2012-11-30 16:11:26 =-
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) 
Chrome/23.0.1271.95 Safari/537.11 on MacIntel
halos and menus   name                         ops/s   ms    
                  show and remove halo items   20      3500  
                  open and close morph menu    20      4400  
bounds            name                         ops/s   ms    
                  bounds()                     2610    28    
drag and grab     name                         ops/s   ms    
                  drag                         10      101200
                  grab                         10      89300 
-= 2012-09-23 16:09:54 =-
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
halos and menus   name                         ops/s   ms    
                  3 show and remove halo items   20      2600  
                  3 open and close morph menu    30      3800  
X