Re: write statement output buffer flush off on Sun
From: James Giles (jamesgiles_at_worldnet.att.net)
Date: 03/30/04
- Next message: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Previous message: Charles Russell: "Re: Directions for installing GNU Fortran"
- In reply to: Robert Corbett: "Re: write statement output buffer flush off on Sun"
- Next in thread: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Reply: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Reply: Jan Vorbrüggen: "Re: write statement output buffer flush off on Sun"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 05:11:21 GMT
Robert Corbett wrote:
> "James Giles" <jamesgiles@worldnet.att.net> wrote in message
> news:<8IO9c.60768$PY1.1118150@bgtnsc05-news.ops.worldnet.att.net>...
...
>> The
>> best way (in terms of efficiency) to implement alternate return
>> is to place the address of the chosen return label onto the stack
>> replacing the normal return address and then execute a normal
>> return.
>
> You are assuming that it is likely an alternate return will be taken
> a high percentage of the time. For most programs where I have seen
> alternate returns used, the normal case is a normal return. The cost
> of passing the addresses of the alternate return labels to the called
> routine is usually greater than the cost of checking for a nonzero
> return value. On a certain popular class of machines where arguments
> are passed on the stack, passing the addresses involves memory traffic.
No. I'm assuming that an alternate return is almost never taken.
In that case, the test of the return-code in the caller after every
procedure can be more expensive than placing some addresses
(statically generated) onto the stack with the other argument
addresses (often also statically known). The first is at least
a load of the return code (memory traffic) and a conditional
branch - and it may involve additional instructions on some
hardware where condition codes must be set explicitly by
some compare or arithmetic operation.
Note that a branch *always* involves memory traffic. Instructions
are in memory. A branch often breaks instruction caching. On some
hardware, a conditional branch costs about the same whether it's
taken or not.
Performing the alternate return logic in the procedure instead of
the caller on some hardware can be a large win (especially if the
procedure is fast and the call is inside a loop). You certainly
can't *assume* that an implementation will use a return code.
-- J. Giles
- Next message: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Previous message: Charles Russell: "Re: Directions for installing GNU Fortran"
- In reply to: Robert Corbett: "Re: write statement output buffer flush off on Sun"
- Next in thread: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Reply: glen herrmannsfeldt: "Re: write statement output buffer flush off on Sun"
- Reply: Jan Vorbrüggen: "Re: write statement output buffer flush off on Sun"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|