Performance Tips and Tricks With ABL
Performance Tips and Tricks With ABL
Performance Tips and Tricks With ABL
Peter Judge
Principal Software Engineer
PSC Confidential
Better performance improves user satisfaction
http://www.gapingvoid.com/Moveable_Type/archives/003955.html
PSC Confidential
Agenda
Coding design
Consider caching
“Warehouse” into ProDataSets for
reporting
• Don’t try to do it all with one FOR EACH
PSC Confidential
Green coding
PSC Confidential
Reduce data volume
No deep copies
PSC Confidential
No deep copies (2)
PSC Confidential
Sequences
create customer.
assign customer.cust-num = next-value(seq_cust_num)
...
create customer.
assign customer.id = string(next-value(seq_table_id),
“9999999”)
...
create customer.
assign customer.id = guid()
...
PSC Confidential
Arrays faster than delimited lists
do i = 1 to num-entries(cList, cDelim):
cEntry = entry(i, cList, cDelim).
cArray[1] = “item1”.
cArray[2] = “item2”.
cArray[n] = “itemN”.
do i = 1 to extent(cArray):
/* do stuff with */ cArray[i]
cVar = “abc”.
iVar = 123.
dtVar = now.
ttData.indexField = “Pi”.
ttData.dataField = getPiVal().
assign
cVar = “abc”
iVar = 123
dtVar = now
ttData.indexField = “Pi”
ttData.dataField = getPiVal().
PSC Confidential
Blocks
end. end.
Error handling
o:Method1().
o:Method2().
end.
o:Method1().
o:Method2().
/* Some Other Stuff Happens */
catch e as Progress.Lang.Error:
undo, throw new Progress.Lang.Error (‘oops’).
end catch.
end.
18 © 2009 Progress Software Corporation
PSC Confidential
Error handling (2)
catch e as Progress.Lang.Error:
undo, throw e.
Class properties
class App.Module.ConferenceVenue:
def public property CityName as char no-undo
get. set.
def public property CityLocation as char no-undo
get ():
/* gets lat/long of city as string
from WebService */
end get.
set.
end class.
o = new App.Module.Object().
Effectively an ASSIGN
o:CityName = “Paris”.
Effectively a
cLoc = o:CityLocation. function invocation
PSC Confidential
Combining techniques
j = extent(cArray).
do i = 1 to j:
cArray[i] = cArray2[i].
end.
j = extent(cArray).
n = 50. /* depends on data distribution */
do i = 1 to j by n:
assign cArray[i] = cArray2[i]
cArray[i+1] = cArray2[i+1]
...
cArray[i+n] = cArray2[i+n].
end.
Loop hoisting
do i = 1 to n: if condition1 then
if condition1 then do i = 1 to n:
do: /* stuff */
/* stuff */ end.
end. else
else if condition2 then
if condition2 then do i = 1 to n:
do: /* more stuff */
/* more stuff */ end.
end. else
else do i = 1 to n:
do: /* other stuff */
/* other stuff */ end.
end.
end.
PSC Confidential
Agenda
Measure performance
• The only way to know for sure
• Measure more than once
• Measure against predefined goals
Use regression test suite
• Use constant, realistic environments
• Compare against baselines
• Automate as far as possible
Ongoing, iterative process
• Engineers’ technical awareness
• User feedback
PSC Confidential
Finding performance problems
Agenda
PSC Confidential
R-code & PROPATH
In Summary
PSC Confidential
Q&A
Joseph M. Newcomer
Optimization: Your Worst Enemy
http://www.codeproject.com/KB/tips/optimizationenemy.aspx
Thank You
PSC Confidential
31 © 2009 Progress Software Corporation
Additional slides
PSC Confidential
Optimize network roundtrips
loginWindow.w
1 run getLoginLanguages() getLoginLanguages()
run buildUI().
loginWindow.w
run getUIData() getUiData()
1 run getLoginLanguages()
run getLoginCompanies()
run buildUI().
PSC Confidential
Always use NO-UNDO
do i = 1 to udfGetNumIter(): j = udfGetNumIter().
end. do i = 1 to j: end.
do i = 1 to num-entries(cLst): j = num-entries(cLst).
end. do i = 1 to j: end.
do i = 1 to 10: j = udfGetMaxValue().
j = udfGetMaxValue(). do i = 1 to 10:
/* do something with j */ /* do something with j */
end. end.
PSC Confidential
Know your indexes
PSC Confidential
Dealing with LOGICAL and status values
PSC Confidential
CASE faster than nested IF
case cAlpha:
when “A” then ...
when “B” then ...
when “C” then ...
otherwise ...
end case.
PSDN
• Profiler
http://www.psdn.com/library/entry.jspa?externalID=280&categoryID=1801
• LogRead 1.0 Tool Overview (English & Spanish)
http://www.psdn.com/library/entry.jspa?categoryID=62&externalID=1841
• Log Read Utility
http://www.psdn.com/library/entry.jspa?categoryID=41&externalID=349
Documentation:
• OpenEdge® Deployment: Managing ABL Applications
PSC Confidential
Relevant Exchange Sessions
PSC Confidential
[MAYBE] Combining techniques
j = extent(cArray).
do i = 1 to j:
cArray[i] = cArray2[i].
end.
j = extent(cArray).
n = 50. /* depends on data distribution */
do i = 1 to j by n:
assign cArray[i] = cArray2[i]
cArray[i+1] = cArray2[i+1]
...
cArray[i+n] = cArray2[i+n].
end.
do i = 1 to n: if condition1 then
if condition1 then do i = 1 to n:
do: /* stuff */
/* stuff */ end.
end. else
else if condition2 then
if condition2 then do i = 1 to n:
do: /* more stuff */
/* more stuff */ end.
end. else
else do i = 1 to n:
do: /* other stuff */
/* other stuff */ end.
end.
end.
PSC Confidential