Performance Questions and a little need for some education.
Bob Deskin
Bob.Deskin at ca.ibm.com
Tue Aug 18 09:28:34 CDT 2009
I can tell you how DEFINEs and TEMPs work but as to the results, I would
have to see the complete source code. There are potentially too many other
things going on.
What Ken writes is correct. Here's the theoretical background:
DEFINEs in QUIZ are evaluated a maximum of once per record complex as soon
as the data needed to do the evaluation is available. So if I have:
ACCESS A LINK TO B LINK TO C
DEFINE X = 5
The define is actually evaluated before anything is read. Also, DEFINE
with PARM is also done before anything is read.
But if I have
DEFINE Y = 5 IF C1 OF C = "YES"
Then Y can't be evaluated until a C row/record is read. By the way, this
gives you a way of artificially delaying the evaluation of a complex
define. Use
DEFINE defined_item = <complex-expression> IF RECORD C EXISTS
The IF RECORD C EXISTS forces the evaluation to be done when C is read
even if it could have been done earlier. But I digress...
In QTP (as in QUICK), DEFINEs are evaluated when they are referenced. So
if a DEFINEd item is never referenced, it is never evaluated. This also
means that if a DEFINEd item is referenced more than once, it is evaluated
each time it is referenced. So any technique of delaying evaluation, that
meant something in QUIZ, means nothing in QTP.
In QTP, TEMP items are under developer control. That is, you specify what
you want and when you want it, and QTP does what you tell it. So in the
following:
ACCESS A
DEFINE d_item = <expression of A items>
TEMP t_item
ITEM t_item = <expression of A items>
SUBFILE sub KEEP INCLUDE d_item, t_item
The sequence is (notice no sort):
Read an A row
Set the value of t_item = <expression of A items>
Set up the subfile buffer
Evaluate d_item and move it into the subfile
Move the value of t_item into the subfile
Write the subfile record
If I had this in QUIZ:
ACCESS A
DEFINE d_item = <expression of A items>
SET SUBFILE sub KEEP
REPORT SUMMARY d_item
The sequence would be
Read an A row
Evaluate d_item
Set up the subfile/report buffer
Move the value of d_item into the subfile
Write the subfile record
Granted there's only a subtle difference in this example.
Bob
From:
"Ken Langendock" <ken.langendock at rogers.com>
To:
<powerh-l at lists.sowder.com>
Date:
2009-08-18 10:12 AM
Subject:
RE: Performance Questions and a little need for some education.
Sent by:
powerh-l-bounces+bob.deskin=ca.ibm.com at lists.sowder.com
Unfortunately I have to agree with your client on the QTP/QUIZ argument.
QTP is (IMHO) a much smarter tool to use for “simple, straight forward
extracts to create CSV files”. QTP Allows you to do more with the extracts
than QUIZ. It also gives you more readable statistics to find problems
than QUIZ. QTP allows you to logically break up an extract into REQUESTS,
where QUIZ needs separate programs.
QUIZ also has/had a problem with extracting more than 32767 records into a
text file (NO HEAD, PAGE LENGTH 0), it inserted blank lines somewhere in
the middle of the file for no reason. After that I used QTP.
In short and IMHO, QUIZ is DUMB and should only be used to report the
contents of a subfile.
As for the TEMP/DEFINE issue, I agree with you.
I think the assumption that DEFINES are slower than TEMPS is a little
clouded. A straight DEFINE vs. a similar program than uses TEMPS is not
going to give you any major benefit.
If you have cascading DEFINES or DEFINES that are referenced multiple
times, then TEMPS would be a performance improvement as the DEFINE is
re-evaluated every time it is referenced and the TEMP is only evaluated
once per record complex.
BUT. If you incorporate OUTPUT PHASE READS and TEMPS, and/or TEMPS with an
AT statement…then you start leaving QUIZ and DEFINES far behind.
By OUTPUT PHASE READING all files that are NOT required in the record
complex (like Client Names, Address Types, etc), your record complex is
much smaller and therefore much faster.
Of course if you had the option of an SQL database, then you can move the
ACCESS statement into a CURSOR and retrieve only the columns you want,
everything increases exponentially.
Just my two cents worth. I’ve been doing this for a few years now and
stick to what I have proven works best. I did the same benchmarks back in
the late 80’s and found quiz was faster at dumping a file, but most
programs never stay that way. Sooner or later someone wants more in “that”
report, so I always start out calling my quiz-only programs ??R01B.QZS
just in case I need to add a QTP extract in front of it down the road.
Ken
From: powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com [
mailto:powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com] On
Behalf Of John Stires
Sent: August 18, 2009 9:46 AM
To: powerh-l at lists.sowder.com
Subject: [Bulk] Performance Questions and a little need for some
education.
I have always been under the understanding that, in general, you use TEMP
ITEMs in QTP rather than DEFINEs. The client where I am currently working
needs some convincing and is willing for me to run a bench test. They
use QTP heavily for doing simple, straight forward extracts to create CSV
files. I have strongly suggested that QUIZ would be a much better tool
or, at least use TEMPs instead of DEFINEs.
I took one of their production extract QTP programs with loads of DEFINES
and converted them all to TEMP ITEMs. This is the only difference. The
original does not have as many cascading DEFINEs as most of their programs
so this is an even better test in comparing the performance of DEFINES vs.
TEMPs and then vs. QUIZ to create the same output file.
I ran my test programs numerous times manually on the development machine
and got execution times pretty much as I expected.
Records Processed DEFINEs TEMPs QUIZ
123,800 0:0:54 0:00:53
0:00:45
Then I put them into a COM file and ran them with a SHOW TIME before and
after the programs.
Records Processed DEFINEs TEMPs QUIZ
123,800 0:0:53 0:00:53
0:00:45
Then I took these three COM files to their production machine and got
totally unexpected results:
Records Processed DEFINEs TEMPs QUIZ
158,802 0:00:53 0:01:01
0:00:57
The development machine is an ALPHA running OpenVMS V8.3 with PowerHouse
version 8.40.D running against RMS files..
The production machine is a Titanium running the same version of VMS and
PowerHouse.
Can someone explain to me how DEFINES can actually run faster the TEMPs
and even a comparable QUIZ program? This kind of shakes my long standing
belief system in how QTP works.
Thanks,
John Stires
--
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l at lists.sowder.com
Subscribe: 'subscribe' in message body to
powerh-l-request at lists.sowder.com
Unsubscribe: 'unsubscribe <password>' in message body to
powerh-l-request at lists.sowder.com
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Add 'site:lists.sowder.com powerh-l' to your search terms to search the
list archive at Google.
More information about the powerh-l
mailing list