SQL records in a result
set
Program stack storage
Java Virtual Machine
and most WebSphere
storage
System values
Operating System
copies (e.g. Data Base)
copies of application
records
SQL Result Set
(nonrecord)
Static storage from
RPG and COBOL.
Static final in Java.
Direct Execution Java
Programs
Java (and C/C++)
objects
File Buffers of all kinds
Total Job Storage
Subsystem Descriptions
Data Base Records and
IFS file records
Java threads
Just In Time compiled
programs (Java *JIT)
ILE and OS/400
Programs
Order(N)
Order(t)
Order(j)
Order(1)
A Brief Example
To show these concepts, consider a simple example.
Part of a financial system has three logical elements to deal with:
1. An order record (order summary including customer information, sales tax, etc.)
2. An order detail record (individual purchased items, quantities, prices).
3. A table containing international currency rates of exchange between two arbitrary countries.
Question: What is more important? Reducing the cost of the detail record by a couple of bytes, or
reducing the currency table from a cost of N squared (where “N” is the number of countries) to 2 times N.
There are two obvious implementations of the currency table:
1. Implement the table as a two dimensional array such that CurrencyExchangei,j will give the exchange
between country
i
and country
j
for all countries.
2. Implement the table as a single dimension array with the
i
th element being the exchange rate between
country
i
and the US dollar. One can convert to any country simply by converting twice; once to dollars
and once to the other currency.
Clearly, the second is more storage efficient.
Now consider the first problem. The detail record looks like this:
Quantity as a four byte number (9B or 10B in RPG terms).
Name of the item (up to 60 characters)
Price of the item (as a zoned decimal field, 15 total digits with two decimal points).
A simple scrub would give:
Quantity as a two byte number (4B in RPG terms).
Name of the item (probably still 60 characters)
Price of the item (as a packed decimal field, probably 10 total digits with two decimal points).
IBM i 6.1 Performance Capabilities Reference - January/April/October 2008
©
Copyright IBM Corp. 2008
Chapter 20 - General Tips and Techniques
318