[mercury-users] Mercury in academic teaching?
Ralph Becket
rafe at csse.unimelb.edu.au
Wed Oct 11 13:42:44 AEST 2006
Peter Schachte, Wednesday, 11 October 2006:
> On Wed, Oct 11, 2006 at 12:46:45PM +1000, Jonathan Morgan wrote:
> > I'm quite
> > happy with the approach of Mercury, that (generally) optimisations
> > should be done by the compiler, not the user.
>
> Mercury does that at a low level, through it's optimized execution
> model and various standard and non-standard compiler optimizations.
> But, AFAIK (correct me if I'm wrong), these optimizations only improve
> the constant factors -- significantly, but still only constant
> factors.
Not entirely: the accumulator introduction optimisation can turn a quadratic
algorithm into a linear one; so can memoisation.
> The user must still optimize the code.
I disagree: the user should only ever optimise code if performance is
inadequate. If it is, hand optimization must be guided by profiling
data. And note that hand optimisation requires a fair understanding of the
underlying execution algorithm (so it's something we should positively
discourage beginners from doing!)
I would like to see students optimising code for simplicity and clarity,
but I have no idea how to teach that effectively. I'm often amazed at
the baroque schemes they can come up with for solving the simple
problems.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list