Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: "Chuck Stevens" <charles.stevens@xxxxxxxxxx>
- Date: Fri, 10 Jun 2005 13:32:08 -0700
"Pete Dashwood" <dashwood@xxxxxxxxxxxxxx> wrote in message
news:3gsc9uFe0rs5U1@xxxxxxxxxxxxxxxxx
> This is where I argue that the TIME to do that compare cannot be faster
than
> the time to do your branch (irrespective of the branch being unconditional
> or conditional, or static, or dynamic.)
....
> If your 'comparison' breaks down into a series of steps (and you are not
the
> only architure where this happens) then we need to get the cycle time for
> each of the steps.
I found some figures from a somewhat-recent system.
First case: Presuming no concatenation, branch prediction and so forth, it
appears that BRUN consumes one clock or less.
Second case: The collection of operations (say, four instructions -- for
example VALC, ZERO, EQUL, BRTR) required to retrieve properly-described
numeric values to the stack, compare them against numeric literals, and
branch conditionally based on that comparison should take four clocks or
less.
In contrast, depending on the architecture, the three instructions needed to
accomplish a dynamic branch from an empty-stack state consume from around
fifteen to as many as seventy clock cycles. Two of these are one clock or
less (NAMC, LODT); it's the dynamic branch itself -- DBUN, as I've said
before -- that's the killer. When ya gotta use it, ya gotta use it.
> The whole of my contention is that comparison MUST take longer than
> branching. Nothing to do with ALTER (any more...:-))
>
> Your statement was that it may not on Unisys architecture. I can't believe
> it. (I'm not saying you're wrong because I am not an expert in this
> architecture, but logic and experience tell me it simply doesn't make
sense.
> So there must be something I am missing here... or not.)
DBUN is now, and has always been, more costly than the simplest of numeric
comparisons taken in combination with static conditional branches, to say
nothing of being more costly than the comparisons taken without associated
logic to test the conditions.
To return to the original point: It is *not* a universal truism that ALTER
performs better than using an explicit run-time switch.
There are environments in which testing an explicit run-time switch in the
source code is significantly more efficient than using ALTER.
And to answer the more recent point: there are environments in which the
testing of a simple run-time switch does not outweigh the cost of *some*
unconditional branches.
-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
- 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: interesting use of NEXT SENTENCE vs. CONTINUE
- Next by Date: Re: Numeric validation revisited
- 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
|