From: usenet.ufl.edu!travis.csd.harris.com!ada1.ssd.csd.harris.com!danr@gatech. edu (Dan Rittersdorf)
Subject: Re: and then
Date: 9 Apr 93 14:06:50 GMT [thread overview]
Message-ID: <1q3vtq$2lt@travis.csd.harris.com> (raw)
In article <1993Apr7.162133.3564@nosc.mil> sampson@nosc.mil (Charles H. Sampson
) writes:
>
> Unfortunately, that style can conflict with efficiency considerations.
>Ada compiler writers appear to have abdicated their responsibility and make
>no attempt to determine when boolean operations can be optimized as short-
>circuit. (Somebody contradict me, please.) They apparently feel that if
>the programmer wants short-circuit he can ask for it. In addition, there
>are cases when it is unreasonable to expect such an optimization; when the
>second operand contains a function reference, for example.
>
> Charlie
Charlie,
Some vendors, especially those that have concentrated on excellent
optimization, like (blatant plug alert) Harris, do make this
optimization when it can be determined that the operands of
the boolean operator have no side effects. Someone else also stated
that the LRM requires the evaluation of the operands, but I think
several people have done a good job of arguing that one to the
ground, so I won't.
I find it odd, though, that you feel a vendor has some *responsibility*
to provide this optimization. Each possible optimization has a cost and
a benefit -- to the vendor and the user, and each vendor decides what
optimizations they can afford to provide, given the benefit (profit)
that can be obtained. That's business. If a vendor decides that benefits
of providing short circuit boolean optimizations don't outweigh their
investment, they may well decide not to provide it. They have no
responsibility to provide it -- just the option. If you want it,
let your vendor know. They can't know what the customer wants if the
customer doesn't tell them. If they're unresponsive, remember that
they still have to weigh the benefit to their entire user community
against the cost to the same. Sometimes one user's request can't be
granted if the impact to the entire user community would be deemed
too great (for example, if the requested optimization were to require
adding a new, time consuming pass to the compiler which would increase
everybody's compile times).
Note: I'm not implying that the short circuit optimization would
require a cost of that magnitude -- those are separate examples...)
The language provides two forms of the operators, and one requires
short circuiting. If that's what you want, say so; compilers don't have
dwim switches yet. If you don't care, use the general form of the
operator, but in doing so, you inform the compiler that short circuiting is
NOT required, so don't be surprised if you don't get it.
I hope this doesn't sound like a flamer -- if so, my apologies. I just
wanted to provide a vendor perspective on the issue. And you did ask for
contradictions... :-)
--
-danr
______________________________________________________________________________
Dan Rittersdorf danr@ada1.ssd.csd.harris.com
Harris Corporation, Computer Systems Division, Fort Lauderdale, FL 33309
Michigan Address: 233 Pippin Drive, Sparta, MI 49345
______________________________________________________________________________
next reply other threads:[~1993-04-09 14:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-04-09 14:06 Dan Rittersdorf [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-04-12 18:38 and then Charles H. Sampson
1993-04-12 13:29 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n
1993-04-11 3:55 Michael Feldman
1993-04-10 19:52 Alex Blakemore
1993-04-10 15:43 Dik T. Winter
1993-04-10 15:36 Dik T. Winter
1993-04-10 9:39 munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!usenet
1993-04-10 1:03 Charles H. Sampson
1993-04-09 18:08 Dave Bashford
1993-04-08 22:35 Andrew Dunstan,,2285592,
1993-04-08 22:28 Alex Blakemore
1993-04-08 19:03 Art Duncan
1993-04-08 16:18 Charles H. Sampson
1993-04-08 15:34 Christopher J. Henrich
1993-04-08 12:21 enterpoop.mit.edu!usc!cs.utexas.edu!mars.tsd.arlut.utexas.edu!gardner
1993-04-07 22:58 Mark Lundquist
1993-04-07 21:07 Ray Harwood -- Data Basix: (602)721-1988
1993-04-07 16:21 Charles H. Sampson
1993-04-07 12:42 Robert Firth
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox