Bifrost

93
Letting Smalltalk Loose Jorge Ressia www.scg.unibe.ch Tuesday, August 23, 11

Transcript of Bifrost

Page 1: Bifrost

Letting Smalltalk Loose

Jorge Ressia

www.scg.unibe.ch

Tuesday, August 23, 11

Page 2: Bifrost

Computer revolution has not

happened yet

Tuesday, August 23, 11

Page 3: Bifrost

Computer revolution has not

happened yetAlan Kay

Keynote OOPSLA 1997

Tuesday, August 23, 11

Page 4: Bifrost

improve previous ways of thinking

Tuesday, August 23, 11

Page 5: Bifrost

create new ways of thinking

Tuesday, August 23, 11

Page 6: Bifrost

Object-orientedProgramming

Tuesday, August 23, 11

Page 7: Bifrost

Dynamic

Tuesday, August 23, 11

Page 8: Bifrost

We still go back to the source code

Tuesday, August 23, 11

Page 9: Bifrost

Debugging

Tuesday, August 23, 11

Page 10: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 11: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 12: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 13: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 14: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 15: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 16: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 17: Bifrost

Profiling

Tuesday, August 23, 11

Page 18: Bifrost

Profile

}

{

}

{

}

{}

{

}

{

Domain-Specific Profiling 3

CPU time profiling

Mondrian [9] is an open and agile visualization engine. Mondrian describes avisualization using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1. Tracking down the cause of the poorperformance was not trivial. We first used a standard sample-based profiler.

Execution sampling approximates the time spent in an application’s methodsby periodically stopping a program and recording the current set of methodsunder executions. Such a profiling technique is relatively accurate since it haslittle impact on the overall execution. This sampling technique is used by almostall mainstream profilers, such as JProfiler, YourKit, xprof [10], and hprof.

MessageTally, the standard sampling-based profiler in Pharo Smalltalk2, tex-tually describes the execution in terms of CPU consumption and invocation foreach method of Mondrian:

54.8% {11501ms} MOCanvas>>drawOn:54.8% {11501ms} MORoot(MONode)>>displayOn:30.9% {6485ms} MONode>>displayOn:

| 18.1% {3799ms} MOEdge>>displayOn:...

| 8.4% {1763ms} MOEdge>>displayOn:| | 8.0% {1679ms} MOStraightLineShape>>display:on:| | 2.6% {546ms} FormCanvas>>line:to:width:color:...

23.4% {4911ms} MOEdge>>displayOn:...

We can observe that the virtual machine spent about 54% of its time inthe method displayOn: defined in the class MORoot. A root is the unique non-nested node that contains all the nodes of the edges of the visualization. Thisgeneral profiling information says that rendering nodes and edges consumes agreat share of the CPU time, but it does not help in pinpointing which nodesand edges are responsible for the time spent. Not all graphical elements equallyconsume resources.

Traditional execution sampling profilers center their result on the frames ofthe execution stack and completely ignore the identity of the object that receivedthe method call and its arguments. As a consequence, it is hard to track downwhich objects cause the slowdown. For the example above, the traditional profilersays that we spent 30.9% in MONode>>displayOn: without saying which nodeswere actually refreshed too often.

Coverage

PetitParser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as objects that can be reconfigured dynamically [11].

1 http://forum.world.st/Mondrian-is-slow-next-step-tc2257050.html#a2261116

2 http://www.pharo-project.org/

Tuesday, August 23, 11

Page 19: Bifrost

Domain

Profile

}

{

}

{

}

{}

{

}

{

Domain-Specific Profiling 3

CPU time profiling

Mondrian [9] is an open and agile visualization engine. Mondrian describes avisualization using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1. Tracking down the cause of the poorperformance was not trivial. We first used a standard sample-based profiler.

Execution sampling approximates the time spent in an application’s methodsby periodically stopping a program and recording the current set of methodsunder executions. Such a profiling technique is relatively accurate since it haslittle impact on the overall execution. This sampling technique is used by almostall mainstream profilers, such as JProfiler, YourKit, xprof [10], and hprof.

MessageTally, the standard sampling-based profiler in Pharo Smalltalk2, tex-tually describes the execution in terms of CPU consumption and invocation foreach method of Mondrian:

54.8% {11501ms} MOCanvas>>drawOn:54.8% {11501ms} MORoot(MONode)>>displayOn:30.9% {6485ms} MONode>>displayOn:

| 18.1% {3799ms} MOEdge>>displayOn:...

| 8.4% {1763ms} MOEdge>>displayOn:| | 8.0% {1679ms} MOStraightLineShape>>display:on:| | 2.6% {546ms} FormCanvas>>line:to:width:color:...

23.4% {4911ms} MOEdge>>displayOn:...

We can observe that the virtual machine spent about 54% of its time inthe method displayOn: defined in the class MORoot. A root is the unique non-nested node that contains all the nodes of the edges of the visualization. Thisgeneral profiling information says that rendering nodes and edges consumes agreat share of the CPU time, but it does not help in pinpointing which nodesand edges are responsible for the time spent. Not all graphical elements equallyconsume resources.

Traditional execution sampling profilers center their result on the frames ofthe execution stack and completely ignore the identity of the object that receivedthe method call and its arguments. As a consequence, it is hard to track downwhich objects cause the slowdown. For the example above, the traditional profilersays that we spent 30.9% in MONode>>displayOn: without saying which nodeswere actually refreshed too often.

Coverage

PetitParser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as objects that can be reconfigured dynamically [11].

1 http://forum.world.st/Mondrian-is-slow-next-step-tc2257050.html#a2261116

2 http://www.pharo-project.org/

Tuesday, August 23, 11

Page 20: Bifrost

Mondrian

Tuesday, August 23, 11

Page 21: Bifrost

Tuesday, August 23, 11

Page 22: Bifrost

System ComplexityLanza and Ducasse 2003

Tuesday, August 23, 11

Page 23: Bifrost

Domain-Specific Profiling 3

CPU time profiling

Mondrian [9] is an open and agile visualization engine. Mondrian describes avisualization using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1. Tracking down the cause of the poorperformance was not trivial. We first used a standard sample-based profiler.

Execution sampling approximates the time spent in an application’s methodsby periodically stopping a program and recording the current set of methodsunder executions. Such a profiling technique is relatively accurate since it haslittle impact on the overall execution. This sampling technique is used by almostall mainstream profilers, such as JProfiler, YourKit, xprof [10], and hprof.

MessageTally, the standard sampling-based profiler in Pharo Smalltalk2, tex-tually describes the execution in terms of CPU consumption and invocation foreach method of Mondrian:

54.8% {11501ms} MOCanvas>>drawOn:54.8% {11501ms} MORoot(MONode)>>displayOn:30.9% {6485ms} MONode>>displayOn:

| 18.1% {3799ms} MOEdge>>displayOn:...

| 8.4% {1763ms} MOEdge>>displayOn:| | 8.0% {1679ms} MOStraightLineShape>>display:on:| | 2.6% {546ms} FormCanvas>>line:to:width:color:...

23.4% {4911ms} MOEdge>>displayOn:...

We can observe that the virtual machine spent about 54% of its time inthe method displayOn: defined in the class MORoot. A root is the unique non-nested node that contains all the nodes of the edges of the visualization. Thisgeneral profiling information says that rendering nodes and edges consumes agreat share of the CPU time, but it does not help in pinpointing which nodesand edges are responsible for the time spent. Not all graphical elements equallyconsume resources.

Traditional execution sampling profilers center their result on the frames ofthe execution stack and completely ignore the identity of the object that receivedthe method call and its arguments. As a consequence, it is hard to track downwhich objects cause the slowdown. For the example above, the traditional profilersays that we spent 30.9% in MONode>>displayOn: without saying which nodeswere actually refreshed too often.

Coverage

PetitParser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as objects that can be reconfigured dynamically [11].

1 http://forum.world.st/Mondrian-is-slow-next-step-tc2257050.html#a2261116

2 http://www.pharo-project.org/

Tuesday, August 23, 11

Page 24: Bifrost

Which is the relationship?Domain-Specific Profiling 3

CPU time profiling

Mondrian [9] is an open and agile visualization engine. Mondrian describes avisualization using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1. Tracking down the cause of the poorperformance was not trivial. We first used a standard sample-based profiler.

Execution sampling approximates the time spent in an application’s methodsby periodically stopping a program and recording the current set of methodsunder executions. Such a profiling technique is relatively accurate since it haslittle impact on the overall execution. This sampling technique is used by almostall mainstream profilers, such as JProfiler, YourKit, xprof [10], and hprof.

MessageTally, the standard sampling-based profiler in Pharo Smalltalk2, tex-tually describes the execution in terms of CPU consumption and invocation foreach method of Mondrian:

54.8% {11501ms} MOCanvas>>drawOn:54.8% {11501ms} MORoot(MONode)>>displayOn:30.9% {6485ms} MONode>>displayOn:

| 18.1% {3799ms} MOEdge>>displayOn:...

| 8.4% {1763ms} MOEdge>>displayOn:| | 8.0% {1679ms} MOStraightLineShape>>display:on:| | 2.6% {546ms} FormCanvas>>line:to:width:color:...

23.4% {4911ms} MOEdge>>displayOn:...

We can observe that the virtual machine spent about 54% of its time inthe method displayOn: defined in the class MORoot. A root is the unique non-nested node that contains all the nodes of the edges of the visualization. Thisgeneral profiling information says that rendering nodes and edges consumes agreat share of the CPU time, but it does not help in pinpointing which nodesand edges are responsible for the time spent. Not all graphical elements equallyconsume resources.

Traditional execution sampling profilers center their result on the frames ofthe execution stack and completely ignore the identity of the object that receivedthe method call and its arguments. As a consequence, it is hard to track downwhich objects cause the slowdown. For the example above, the traditional profilersays that we spent 30.9% in MONode>>displayOn: without saying which nodeswere actually refreshed too often.

Coverage

PetitParser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as objects that can be reconfigured dynamically [11].

1 http://forum.world.st/Mondrian-is-slow-next-step-tc2257050.html#a2261116

2 http://www.pharo-project.org/

?

Tuesday, August 23, 11

Page 25: Bifrost

What is the problem?

Tuesday, August 23, 11

Page 26: Bifrost

Fixed Object Model

Tuesday, August 23, 11

Page 27: Bifrost

Most of the time this is good

Tuesday, August 23, 11

Page 28: Bifrost

Restricts what we can do

Tuesday, August 23, 11

Page 29: Bifrost

Time

Tuesday, August 23, 11

Page 30: Bifrost

Time is a very useful concept

Tuesday, August 23, 11

Page 31: Bifrost

considering it absolute limit us

Tuesday, August 23, 11

Page 32: Bifrost

absolute object model limit us

Tuesday, August 23, 11

Page 33: Bifrost

objects that evolve

Tuesday, August 23, 11

Page 34: Bifrost

Why?

Tuesday, August 23, 11

Page 35: Bifrost

ExecutionReification

StructureEvolution

ProfilingDebugging

Tuesday, August 23, 11

Page 36: Bifrost

ExecutionReification

StructureEvolution

ProfilingDebugging

Tuesday, August 23, 11

Page 37: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 38: Bifrost

}

{

}

{

}

{}

{

}

{

Tuesday, August 23, 11

Page 39: Bifrost

When is the next state written?

Tuesday, August 23, 11

Page 40: Bifrost

Stop when the next message is received

Tuesday, August 23, 11

Page 41: Bifrost

Close the gap

Tuesday, August 23, 11

Page 42: Bifrost

Object Debugger

Tuesday, August 23, 11

Page 43: Bifrost

ExecutionReification

StructureEvolution

Debugging Profiling

Tuesday, August 23, 11

Page 44: Bifrost

MetaSpy

Tuesday, August 23, 11

Page 45: Bifrost

MetaSpy

TOOLS 2011Bergel etal.

Tuesday, August 23, 11

Page 46: Bifrost

Mondrian Profiler

Tuesday, August 23, 11

Page 47: Bifrost

Tuesday, August 23, 11

Page 48: Bifrost

System ComplexityLanza, Ducasse 2003

Tuesday, August 23, 11

Page 49: Bifrost

Tuesday, August 23, 11

Page 50: Bifrost

Profiling

StructureEvolution

Debugging

ExecutionReification

Tuesday, August 23, 11

Page 51: Bifrost

What if we do not know what to evolve?

Tuesday, August 23, 11

Page 52: Bifrost

Tuesday, August 23, 11

Page 53: Bifrost

?Tuesday, August 23, 11

Page 54: Bifrost

Prisma

Tuesday, August 23, 11

Page 55: Bifrost

ScarringTuesday, August 23, 11

Page 56: Bifrost

Tuesday, August 23, 11

Page 57: Bifrost

Tuesday, August 23, 11

Page 58: Bifrost

Tuesday, August 23, 11

Page 59: Bifrost

Tuesday, August 23, 11

Page 60: Bifrost

ScanningTuesday, August 23, 11

Page 61: Bifrost

Tuesday, August 23, 11

Page 62: Bifrost

Tuesday, August 23, 11

Page 63: Bifrost

Tuesday, August 23, 11

Page 64: Bifrost

Tuesday, August 23, 11

Page 65: Bifrost

Tuesday, August 23, 11

Page 66: Bifrost

Tuesday, August 23, 11

Page 67: Bifrost

Tuesday, August 23, 11

Page 68: Bifrost

Back in time Debugger

Tuesday, August 23, 11

Page 69: Bifrost

Back in time Debugger

Object Flow Debugger

Lienhard etal. ECOOP 2008

Tuesday, August 23, 11

Page 70: Bifrost

Instance variable history

Tuesday, August 23, 11

Page 71: Bifrost

:Person field-write@t2

field-write@t3

init@t1

'Doe'

person := Person new t1...name := 'Doe' t2...name := 'Smith' t3

'Smith'

nullpredecessor

predecessor

value

value

value

name

name

name

Tuesday, August 23, 11

Page 72: Bifrost

Profiling

ExecutionReification

Debugging

StructureEvolution

Tuesday, August 23, 11

Page 73: Bifrost

Talents

scg.unibe.ch/research/talents

Tuesday, August 23, 11

Page 74: Bifrost

Talents

scg.unibe.ch/research/talents

IWST 2011J. Ressia, T. Gîrba, O. Nierstrasz, F. Perin and

L. Renggli

Tuesday, August 23, 11

Page 75: Bifrost

Dynamically composable units of

reuse

Tuesday, August 23, 11

Page 76: Bifrost

moosetechnology.org

Tuesday, August 23, 11

Page 77: Bifrost

aFAMIXClass isTestClass

Keyinstance-ofmessage sendlookup

FAMIXEntity

FAMIXType

isTestClassFAMIXClass

aFAMIXClass

1

2

3

self inheritsFrom: 'TestCase'

MooseEntity

...

Tuesday, August 23, 11

Page 78: Bifrost

aFAMIXClass isTestClass

FAMIXClass

aFAMIXClass

1

2

4

aFAMIXClass inheritsFrom: 'TestCase'

aJeeClassTalent

Keyinstance-ofmessage sendlookupacquire

3aJeeClassTalent talent isTestClass

FAMIXEntity

FAMIXType

MooseEntity

...

Tuesday, August 23, 11

Page 79: Bifrost

•@ alias

•- exclusion

•, composition

Operators

Tuesday, August 23, 11

Page 80: Bifrost

Flattening

Tuesday, August 23, 11

Page 81: Bifrost

Scoping

Tuesday, August 23, 11

Page 82: Bifrost

Evolution friendly Object Model

Tuesday, August 23, 11

Page 83: Bifrost

Tuesday, August 23, 11

Page 84: Bifrost

Organize the Meta-level

Tuesday, August 23, 11

Page 85: Bifrost

ExplicitMeta-objects

Tuesday, August 23, 11

Page 86: Bifrost

Object

Meta-object

Class

Tuesday, August 23, 11

Page 87: Bifrost

Object

Meta-object

Class

Tuesday, August 23, 11

Page 88: Bifrost

Evolved Object

Meta-object

Class

Tuesday, August 23, 11

Page 89: Bifrost

Object>>haltAtNextMessage | aMetaObject | aMetaObject := BFBehavioralMetaObject new. aMetaObject when: (BFMessageReceiveEvent new) do: [ self metaObject unbindFrom: self.

TransparentBreakpoint signal ]. aMetaObject bindTo: self

Tuesday, August 23, 11

Page 90: Bifrost

We let Smalltalk loose

Tuesday, August 23, 11

Page 91: Bifrost

Object Debugger Prisma

Subjectopia MetaSpy

Talents Chameleon

Tuesday, August 23, 11

Page 92: Bifrost

scg.unibe.ch/jenkins/

Tuesday, August 23, 11

Page 93: Bifrost

scg.unibe.ch/research/bifrost

Tuesday, August 23, 11