Re: Re: Mathematica to .NET compiler
- To: mathgroup at smc.vnet.net
- Subject: [mg79466] Re: [mg79432] Re: Mathematica to .NET compiler
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Fri, 27 Jul 2007 05:55:23 -0400 (EDT)
- References: <200707200725.DAA24728@smc.vnet.net> <f7sflm$rs0$1@smc.vnet.net> <f86onh$g19$1@smc.vnet.net> <f89p6l$54l$1@smc.vnet.net> <12189822.1185457140095.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
> component of Mathematica with a piece of code funded by the world's > wealthiest software company, written by dozens of experts over many years > with enormous emphasis on performance. Ah, this wouldn't be that company with the unexplained crashes, viruses, spontaneously corrupted and ever-increasing trash-dump registries, infinitely recurring updates, new versions that won't install on 3-yr-old machines, the most intrusive "browser" on the planet, and... Not THAT company? I'll stick to Mathematica, thanks. Bobby On Thu, 26 Jul 2007 05:29:44 -0500, Jon Harrop <jon at ffconsultancy.com> wrote: > David Bailey wrote: >> Surely to support all those features you would need to write something >> equivalent to a fair portion of the Mathematica kernel - why would your >> code work any faster than Wolfram's? > > Garbage collection for one thing. The real Mathematica uses reference > counting, which is widely known to be both flawed (can't collect cycles) > and slow (was dismissed as a competitive technique decades ago). > Inheriting > a garbage collector from something like .NET lets you replace a core > component of Mathematica with a piece of code funded by the world's > wealthiest software company, written by dozens of experts over many years > with enormous emphasis on performance. > > Type inference for another thing. This technique is widely used in modern > high-performance functional programming languages to combine the brevity > of > Mathematica with the speed of C++. The current Mathematica does no type > inference. > >> I can't see how something like >> >> expr /. f[a_]->a^2 >> >> can usefully be compiled if you don't know the structure of the >> expression at compile time (which you usually don't). > > You don't need to. That translates directly into SML, OCaml, Haskell or > F#: > > let rule = function > | `Seq(`f, [|a|]) -> a **: Int 2 > | f -> f;; > > replace rule expr;; > > This is a pedagogical example of term rewriting in these languages, which > are used to write theorem provers and compilers and excel at exactly > this. > When "a^2" is trivial to compose, the above OCaml code will be roughly > two > orders of magnitude faster than Mathematica. > >> As far as I can >> see, all you could compile that into would be a call to your pattern >> matching library code! > > Whenever possibly, you would compile into the pattern matches of the > target > language (as I did above). Compilers for these languages already > implement > high-performance optimizing pattern match compilers. So they handle > everything between that and machine code. > -- DrMajorBob at bigfoot.com
- References:
- Mathematica to .NET compiler
- From: Jon Harrop <jon@ffconsultancy.com>
- Mathematica to .NET compiler