Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: "Chuck Stevens" <charles.stevens@xxxxxxxxxx>
- Date: Thu, 9 Jun 2005 10:16:20 -0700
"Pete Dashwood" <dashwood@xxxxxxxxxxxxxx> wrote in message
news:3gpibiFdiejoU1@xxxxxxxxxxxxxxxxx
> I am asking how a machine language BRANCH instruction (which has a SINGLE
> operand), can be SLOWER than a machine language COMPARE instruction that
has
> TWO operands.
We don't really have general "compare" instructions as you seem to describe
them. We have unconditional and conditional branches in both static and
dynamic forms (BRUN, BRTR, BRFL, DBUN, DBTR, DBFL), and the conditionals are
based on the low-order bit of the word on the top of the stack, however that
might get there. There are lots of comparison things that might put a truth
value on top of the stack, and they're of varying complexity and cost. But
I can certainly envision "regular" COBOL logic that does a simple VALC
[one-bit item], BRTR where the code using ALTER might require NAMC [stack
cell containing label's current PCW], LODT, DBUN, and if that's the
comparison that's being drawn then I can't see why VALC, BRTR (or even VALC
[item-1], VALC [item-2], EQUL, BRTR or VALC, ZERO, EQUL, BRTR) should
necessarily be presumed *slower* than the case in which the comparison was
done once outside the logic but the branch itself would have to include
NAMC, LODT, DBUN. In the case of the dynamic branch the system has to be
alert to the possibility that it's a cross-segment branch, which raises the
likelihood that a presencebit interrupt would occur, in turn raising the
"overhead" of the instruction. The in-segment static branch does not
encounter that circumstance.
> Now can we discuss why a Branch instruction is slower than a compare,
if it
> is...?
See above.
> Understand that.
> Now can we discuss why a Branch instruction is slower than a compare, if
it
> is...?
See above.
> Well you have presented a good enough case to at least suggest the
> possibility that ALTERED code in your environment may not be a good thing,
> but I'm not convinced on the actual speed of branch vs compare. I think
the
> 'maybe not' in your sentence above needs expansion...
Comparing a *branch* with a *compare* may be valid in your environment, but
it doesn't really make sense in ours. Comparing the execution-time code
associated with "IF NOT <condition> GO TO NOT-FIRST-TIME" with the code that
resides at <label> for "IF <condition> ALTER <label> TO PROCEED TO
NOT-FIRST-TIME" is not the whole story.
How fast is the evaluation of <condition>? How far is up?
> Unfair! It MAY have to use a dynamic one... I take that point anyway.
In most cases the user has *some* control over that ...
> I would not advocate the use of ALTER in COBOL in modern environments
> (except as a possible wind-up to some people here who take this whole
COBOL
> thing much too seriously...).
Well, as a strong advocate of sticking to *standard* COBOL, I would repeat
that the COBOL community was put on notice some twenty years ago that ALTER
was doomed, and the construct has not been valid standard COBOL syntax for
nigh onto three years now ... ;-)
-Chuck Stevens
.
- Follow-Ups:
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- References:
- interesting use of NEXT SENTENCE vs. CONTINUE
- From: Frank Swarbrick
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Richard
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: William M. Klein
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Richard
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: docdwarf
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Howard Brazee
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Chuck Stevens
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Chuck Stevens
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Chuck Stevens
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- interesting use of NEXT SENTENCE vs. CONTINUE
- Prev by Date: Re: Syntax for embedded sql
- Next by Date: Re: Registration of more then 1 CCITCP2 Servers
- Previous by thread: Re: interesting use of NEXT SENTENCE vs. CONTINUE
- Next by thread: Re: interesting use of NEXT SENTENCE vs. CONTINUE
- Index(es):
Relevant Pages
|