Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-06-22 13:12:13


Fernando Cacciola wrote:

> > Long and short: if you want a high performance
> > implementation, forget about it being 'Standard'.
> > This doesn't apply to the _interface_.
> >
> I disagree.
> IMO, EVERY piece of code in C/C++ can -and eventually must- be ISO
> conformant.
> Performace-related flexibility (explicit optimizations for a given target)
> must be handled by configurable build systems which setup the source files
> to address the target charateristics (eventually using non-C/C++
> components).

        Perhaps we have a misunderstanding here.
If you have to 'configure' the code, then you aren't talking about
a single piece of code that runs on all platforms: what would be
called 'strictly conforming' in ISO C parlance.

> This is the case for GMP.
> In my experience, is the configurable build system of these packages which
> makes it hard to port to win32, not the code itself.

        It makes it hard to port to unix too: last time
I tried, the build failed ... on a LINUX box!

        Again, if you cannot simply recompile the code
on any platform without ANY changes, you do not have
a strictly conforming ISO C program/library.

        There is no corresponding notion in C++,
which is why I put the 'quotes' around the word 'Standard'.

        Configuring systems is the enemy of
good programming, and the arch-enemy of Standardisation.

> > Developing a good interface is not easy.

> The problem is that the choice of non-obvious operations depends on the
> features of the underlaying kernel.
        
        Yes.

> Unless we fix a kernel, the integer class will be able to support only a
> basic interface. But this is OK in most applications.
>
> > The best solution is probably to provide
> > a LOT of routines (some of which will
> > be slow for a given package).
> >
> > Another solution is two levels of interface:
> > basic and advanced.
> >
> I'm not sure about this. I need to see some examples of it.

        The basic interface provides ONLY big integer
operations. It has constructors mapping long integers
to big ints. NO routines like:

        mul(big_int, short);

which can be very much faster than

        mul(big_int, big_int);

The advanced interface contains every conceivable
mixture of big/ordinary integer operations.
Some will be supported directly by the kernel,
other will have to be implemented in the wrapper,
possibly using a slow default.

A _really_ advanced implementation would use lazy evaluation
and caching. This would only require the basic interface.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk