From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,97482af7429a6a62 X-Google-Attributes: gid109fba,public X-Google-Thread: 10d15b,97482af7429a6a62 X-Google-Attributes: gid10d15b,public X-Google-Thread: 103376,97482af7429a6a62 X-Google-Attributes: gid103376,public From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: Language Efficiency Date: 1995/04/19 Message-ID: <9511001.20524@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 101281447 sender: news@cs.mu.OZ.AU (CS-Usenet) references: <3lmt64$stt@dplanet.p2k.cbis.com> <3lrrqk$kbj@usenet.INS.CWRU.Edu> <3ls7u0$3v1@stc06.ctd.ornl.gov> organization: Computer Science, University of Melbourne, Australia newsgroups: comp.lang.c++,comp.lang.ada,comp.lang.cobol Date: 1995-04-19T00:00:00+00:00 List-Id: dewar@cs.nyu.edu (Robert Dewar) writes: >Please substantiate the "heresy" that different languages make a big >difference in generated code efficiency. Sure. There's a language called Prolog, which has been around for a decade or two now. Lots of effort has been put into optimizing it. Hundreds of papers have been written. Dozens of implementations have been developed. I and a couple of others have developed a new language called Mercury over the last year or two. Mercury is similar to a subset of Prolog with additional declarations. We've done quite a bit of benchmarking, and the Mercury compiler produces code that is on average about 70% faster than the code produced by the best optimizing Prolog compiler, Aquarius Prolog, for a set of small benchmarks. (For real-world code the difference is almost certainly _larger_ than 70%, since the techniques used in the Mercury compiler scale better to large programs than those used in Aquarius Prolog.) This difference in efficiency is precisely because Mercury was deliberately designed to make it much easier to generate efficient code. Note that in it's most optimizing mode, Aquarius Prolog does not support certain features of Prolog, because they prevent some optimizations. If you invoke Aquarius Prolog in a mode which supports those features, the generated code is about a factor of two slower. So if you compare Mercury to that, we're about 3.4 times faster. (The feature in question is the ability to write `read(X), call(X)', which can call any predicate with any arguments depending on the input.) For more details, including detailed performance tables, see The execution algorithm of Mercury: an efficient purely declarative logic programming language. Zoltan Somogyi, Fergus James Henderson and Thomas Charles Conway. available from http://www.cs.mu.oz.au/~zs/mercury.html. -- Fergus Henderson | As practiced by computer science, the study of fjh@cs.mu.oz.au | programming is an unholy mixture of mathematics, http://www.cs.mu.oz.au/~fjh | literary criticism, and folklore. - B. A. Sheil