+ All Categories
Home > Documents > the diary of a datum the diary of a datum

the diary of a datum the diary of a datum

Date post: 10-May-2015
Category:
Upload: tess98
View: 314 times
Download: 6 times
Share this document with a friend
Popular Tags:
36
the diary of a datum the diary of a datum ( modeling runtime behavior in framework-based applications) modeling runtime behavior in framework-based applications) Nick Mitchell, Gary Sevitsky, Harini Srinivasan IBM T.J. Watson Research Center Hawthorne, NY USA July 7, 2006
Transcript
Page 1: the diary of a datum the diary of a datum

the diary of a datumthe diary of a datum

((modeling runtime behavior in framework-based applications)modeling runtime behavior in framework-based applications)

Nick Mitchell, Gary Sevitsky, Harini SrinivasanIBM T.J. Watson Research Center

Hawthorne, NY USA

July 7, 2006

Page 2: the diary of a datum the diary of a datum

the diary of a timecardthe diary of a timecard

parseXML

documentbusinessobject

MQmessage

extractcontent

store inDB2

record

copy (andrepackage)serialize serialized

Java objectDB2blob

DB2record

cost of parsestep:- 2000 calls- 300 objects

● from a deployed server application– extensively uses frameworks (large-scale applications act as integrators)

– this is par for the course for rich clients, too

● that's a lot of work for such a simple task!– what makes this silly is the large number of data transformations

Page 3: the diary of a datum the diary of a datum

hotspot-free bloathotspot-free bloat

● tuning the easy stuff may remove hot spots– bye bye bubble sort!

● but bloat remains– the runtime complexity and cost of hotspot-free programs is high

parseXML

documentbusinessobject

MQmessage

extractcontent

store inDB2

record

copy (andrepackage)serialize serialized

Java objectDB2blob

DB2record

cost of parsestep:- 2000 calls- 300 objects

Page 4: the diary of a datum the diary of a datum

the diary of a datum methodologythe diary of a datum methodology

● the analysis scenario– structure activity based on information flow

● code-agnostic classification– label forms of data, and transformations between them, according to the

purpose they serve in the scenario

● behavior signatures– quantify runtime complexity and costs of a scenario in code-agnostic terms

Page 5: the diary of a datum the diary of a datum

part I: the analysis scenariopart I: the analysis scenario

structuring computation as flows of the physical forms of logical content

Page 6: the diary of a datum the diary of a datum

information contentinformation content

● various physical representations– binary (MQ message)

– unicode XML (SOAP)

– heap object (Java)

– binary (serialized Java object)

– binary (DB2 blob)

● one a logical collection of information– timecard

● each at the same level of granularity– record (e.g. timecard)

– field (e.g. dates, serial number, manager)

– subfield (e.g. month or day of a date)

Page 7: the diary of a datum the diary of a datum

an example analysis scenarioan example analysis scenario

analysis scenariocode:

logical content:source:

sink:

Trade benchmark v.3.1 (acting as a SOAP client)

stock purchase date (field granularity)

subsequence of a SOAP message (as bytes)

a field in a Java object (used for subsequent HTML rendering)

Copy to another

version of the

business object

Calendar*(Java field)

Date*(Java field)

bytes(SOAP)

Parse, set field

in business object

Cost:- 268 calls- 70 objects

*new objects

Page 8: the diary of a datum the diary of a datum

the diary of a datethe diary of a date

code:logical content:

source:sink:

Trade benchmark v.3.1 (acting as a SOAP client)

stock purchase date (field granularity)

subsequence of a SOAP message (as bytes)

a field in a Java object (used for subsequent HTML rendering)

analysis scenario

Copy to another

version of the

business object

Calendar*(Java field)

Date*(Java field)

bytes(SOAP)

Parse, set field

in business object

Cost:- 268 calls- 70 objects

*new objects

Page 9: the diary of a datum the diary of a datum

zooming in on the SOAP parsingzooming in on the SOAP parsing((detail of just the first step of the previous slide)detail of just the first step of the previous slide)

Parse (using SOAP CalendarDeserializer)

parse using Simple-Date-

Format

String* Date*

parse time zone and

millis; reformat without them

Cost:- 11 calls- 6 objects

add in timezone and millis

Dateextract

value from SOAP tag

bytes(SOAP) String*

Cost:- 30 calls- 3 objects

getschema

info

XML andJava types

BeanPropertyDescriptor

Cost:- 10 calls- 0 objects

get de-serializer

Cost:- 51 calls- 5 objects

Deserializer*

buildCalendar

Calendar*+ 11 arrays*+ TimeZone*

set time

Cost:- 7 calls- 1 object

Cost:- 15 calls- 15 objects

Calendar

Cost:- 95 calls- 39 objects

Cost:- 4 calls- 0 objects

ParsePosition*

TimeZone*(constant)

SimpleDateFormat+ Calendar

2 longs(TZ and millis)

Set business object field via reflection

box into array

call invoke()

onsetter

Object[]*

Cost:- 6 calls- 1 object

Calendar

*new objects

Page 10: the diary of a datum the diary of a datum

zooming in on zooming in on SimpleDateFormat.parseSimpleDateFormat.parse

extract and parse subfield

set field in Calendarint

String x 6 forYY,MM, DD, ...

Calendarcompute

time

create Datefromtime

long Date*

Cost:- 4 calls- 1 object

Cost:- 14 calls- 6 objects

Cost:- 1 calls- 0 objects

Cost:- 0 calls- 1 object

boolean[]**new objects

Page 11: the diary of a datum the diary of a datum

zooming in on the subfield parsingzooming in on the subfield parsing(called for every month, day, year, ...)(called for every month, day, year, ...)

Parse number using DecimalFormat.parse()

Parse long using DigitList.getLong()

extractdigitsString copy digits toString() parse box intValue()Digit-

ListString-Buffer* String* long Long* int

Cost:- 11 calls- 5 objectsCost:

- 4 calls- 3 objects- 600 instructions

Cost:- 1 call- 0 objects

Parse-Position*

boolean[]*

*new objects

Copy:Bit change:Type change:Id change:Create:

Copy-Type changeId change-

Physical change

Copy-Type changeId changeCreate

--Type changeId changeCreate

CopyBit changeType changeId change-

Copy-Type changeId changeCreate

Copy-Type changeId change-

Phenomenon Structure copy Structure copy Rewrap Convert Box Unbox

Fundamental properties

Page 12: the diary of a datum the diary of a datum

part II: the purpose ofpart II: the purpose ofobjects and transformationsobjects and transformations

a multi-dimensional labeling of diagrams

Page 13: the diary of a datum the diary of a datum

transformations as switchestransformations as switches

Page 14: the diary of a datum the diary of a datum

data data immediatelyimmediately used for... used for...

input data output data

faci

ltat

ors

Page 15: the diary of a datum the diary of a datum

only and eventuallyonly and eventually used for... used for...

faci

ltat

or

Page 16: the diary of a datum the diary of a datum

only and eventuallyonly and eventually used for... used for...

faciltator-related activity

faci

ltat

or

Page 17: the diary of a datum the diary of a datum

the purpose of a datumthe purpose of a datum (a taxonomy)(a taxonomy)

Page 18: the diary of a datum the diary of a datum

the purpose of a datumthe purpose of a datum (a taxonomy)(a taxonomy)

the forms of theinformation produced

by the analysis scenario

Page 19: the diary of a datum the diary of a datum

the purpose of a datumthe purpose of a datum (a taxonomy)(a taxonomy)

e.g. SimpleDateFormat,ByteToCharConverter,

XML deserializers

Page 20: the diary of a datum the diary of a datum

example: classifying data by example: classifying data by immediateimmediate purpose purpose

Parse (using SOAP CalendarDeserializer)

parse using Simple-Date-

Format

String* Date*

parse time zone and

millis; reformat without them

Cost:- 11 calls- 6 objects

add in timezone and millis

Dateextract

value from SOAP tag

bytes(SOAP) String*

Cost:- 30 calls- 3 objects

getschema

info

XML andJava types

BeanPropertyDescriptor

Cost:- 10 calls- 0 objects

get de-serializer

Cost:- 51 calls- 5 objects

Deserializer*

buildCalendar

Calendar*+ 11 arrays*+ TimeZone*

set time

Cost:- 7 calls- 1 object

Cost:- 15 calls- 15 objects

Calendar

Cost:- 95 calls- 39 objects

Cost:- 4 calls- 0 objects

ParsePosition*

TimeZone*(constant)

SimpleDateFormat+ Calendar

2 longs(TZ and millis)

Converter

Converter

Carrier

Cursor

Converter

Carrier

Set business object field via reflection

box into array

call invoke()

onsetter

Object[]*

Cost:- 6 calls- 1 object

Calendar

*new objects

Carrier Carrier Carrier Carrier Carrier Carrier Carrier

Schema

Page 21: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

input data output data

Page 22: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

Page 23: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

StringBuffer String

Page 24: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

StringBuffer String

an instance ofan instance ofa a rewraprewrap idiom idiom

of physical changeof physical change

Page 25: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

StringBuffer String

an instance of anan instance of aninformation-preservinginformation-preservingidiom of logical changeidiom of logical change

Page 26: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

byte[] char[]

ByteToCharConverter

Page 27: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

byte[] char[]

ByteToCharConverter

an instance ofan instance ofa a convertconvert idiom idiom

of physical changeof physical change

Page 28: the diary of a datum the diary of a datum

how transformationshow transformationsalter carrier dataalter carrier data

● physical changes– copy

– bit change

– type change

– id change

– new object created

● logical changes– instance

– value

– granularity

addsales taxprice price

New York sales tax

Page 29: the diary of a datum the diary of a datum

labeling transformations according labeling transformations according to to physical changephysical change

Parse number using DecimalFormat.parse()

Parse long using DigitList.getLong()

extractdigitsString copy digits toString() parse box intValue()Digit-

ListString-Buffer* String* long Long* int

Cost:- 11 calls- 5 objectsCost:

- 4 calls- 3 objects- 600 instructions

Cost:- 1 call- 0 objects

Parse-Position*

boolean[]*

*new objects

Copy:Bit change:Type change:Id change:Create:

Copy-Type changeId change-

Physical change

Copy-Type changeId changeCreate

--Type changeId changeCreate

CopyBit changeType changeId change-

Copy-Type changeId changeCreate

Copy-Type changeId change-

Phenomenon Structure copy Structure copy Rewrap Convert Box Unbox

Fundamental properties

Page 30: the diary of a datum the diary of a datum

part III: behavior signaturespart III: behavior signatures

counting transformations by purposeto quantify the complexity and costs

of an analysis scenario

Page 31: the diary of a datum the diary of a datum

even the simple thingseven the simple thingsare hard to get rightare hard to get right

copiespre-1.4.2 1 2 0 11.4.2 1 2 1 01.5.0 1 1 0 0

JDKversion

bitchanges

informationexchanges

carrierscreated

● three versions of StringBuffer.append(int)

Page 32: the diary of a datum the diary of a datum

even the simple thingseven the simple thingsare hard to get rightare hard to get right

copiespre-1.4.2 1 2 0 11.4.2 1 2 1 01.5.0 1 1 0 0

JDKversion

bitchanges

informationexchanges

carrierscreated

● three versions of StringBuffer.append(int)

two “behavior signatures” of physical change

Page 33: the diary of a datum the diary of a datum

even the simple thingseven the simple thingsare hard to get rightare hard to get right

copiespre-1.4.2 1 2 0 11.4.2 1 2 1 01.5.0 1 1 0 0

JDKversion

bitchanges

informationexchanges

carrierscreated

● three versions of StringBuffer.append(int)

one “behavior signature” of logical change

Page 34: the diary of a datum the diary of a datum

even the simple thingseven the simple thingsare hard to get rightare hard to get right

copiespre-1.4.2 1 2 0 11.4.2 1 2 1 01.5.0 1 1 0 0

JDKversion

bitchanges

informationexchanges

carrierscreated

● three versions of StringBuffer.append(int)

one “behavior signature” of object purpose

Page 35: the diary of a datum the diary of a datum

benchmark versus applicationbenchmark versus application(analyzed by idioms of physical change)(analyzed by idioms of physical change)

box/unbox rewrap convertbenchmark 0 0 1 1

app1 3 0 0 1app2 0 2 2 4

structurecopy

box/unbox rewrap convertbenchmark 0 0 1 1

app2 4 1 1 5

structurecopy

● analysis scenario: Date field

● analysis scenario: BigDecimal field

Page 36: the diary of a datum the diary of a datum

a language for discourse about a language for discourse about runtime complexityruntime complexity

● evaluating benchmarks● choosing a framework implementation to use● API design and implementation● identify new compiler optimizations

● inspire adoption of good language constructs– warning: two years later, we'll be back where we started :)


Recommended