Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1832

Re: How to Optimize a Black Box

From Kaz Kylheku <336-986-7787@kylheku.com>
Newsgroups comp.compilers
Subject Re: How to Optimize a Black Box
Date 2017-03-24 20:51 +0000
Organization Aioe.org NNTP Server
Message-ID <17-03-011@comp.compilers> (permalink)
References <17-03-010@comp.compilers>

Show all headers | View raw


On 2017-03-24, Seima Rao <seimarao@gmail.com> wrote:
>     My question is how do we start at all in optimizing a black box ?

If the black box behaves as a function (a pure mapping from some inputs
to some outputs) and that function appears to be expensive, one way to
begin is to look at caching: don't call the black box more than once on
the same combination of inputs. That is, obtain the benefits of the
black box being called M times, with N < M actual calls to the
blackbox, and M - N being canned answers from the cache.

If you can determine some properties of the blackbox without actually
cracking it open, you can exploit them. It could be that, say, outside
of some range of the parameter space, the function has some trivial
result that can be short-circuited; yet the blackbox wastes cycles on
it. A wrapper around it could take a shortcut, bypassing the blackbox.

Like say we have a black-box which calculates the area under the normal
distribution density function, between zero and some x. Suppose the
black box is badly implemented and does lots of expensive calculations
for large magnitudes of x, where the answer just comes out to be the
obvious 0.5 or nearly so. (The "long tail" that outside of x contributes
next to nothing to the area).
We can just put in some logic around it like
(fabs(x)) >= THRESHOLD) ? 0.5 : expensive_blackbox(x);.

In this same vein, we could use a black box side-by-side with a crude
approximation of the black-box. Say we have a black-box which gives
an academically answer for every domain value of some function.
But suppose that in our engineering or scientific application,
most of the time, a "rule of thumb" approximation is completely
satisfactory. We can evaluate the parameters to determine whether the
simple, cheap approximation applies, or whether the blackbox needs
to be invoked because the conditions are such that its superior
model is critically relevant.

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to Optimize a Black Box Seima Rao <seimarao@gmail.com> - 2017-03-24 12:22 +0530
  Re: How to Optimize a Black Box Kaz Kylheku <336-986-7787@kylheku.com> - 2017-03-24 20:51 +0000
  Re: How to Optimize a Black Box George Neuner <gneuner2@comcast.net> - 2017-03-24 22:05 -0400

csiph-web