Re: K interpreter



sa wrote:
i meant to cite the ray-tracer as an example of a problem
for which a full array solution seems (currently) out of
reach. unfortunately, knowing that gets you just halfway
there.

Comparing the fastest k implementation to the slowest OCaml implementation,
the k is 974 bytes and takes 322s to run and the OCaml is 2204 bytes and
takes 28.5s.

I don't believe it is possible to design a set of adverbs that allow all
problems to be solved efficiently in k style. It is clearly possible to
design a set of adverbs that allow some problems to be solved efficiently
in k style (or Mathematica). However, how much effort does it take to
transform a problem into this style in order to get good performance?

I have ported the ray tracer to Mathematica and performance is orders of
magnitude slower than compiled languages for precisely this reason.
Moreover, it would take me a lot longer to optimise the Mathematica than it
took me to optimise the OCaml (which was very fast the first time around).

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html
.



Relevant Pages

  • Re: RAD vs. performance
    ... That is completely wrong for OCaml. ... Appending to either arrays or lists ... it would only happen when either 1) there's no way to optimise it, ...
    (comp.lang.misc)
  • Re: A question on Newtons Method
    ... bug reports per day. ... there are arbitrary-precision integers and rationals (Num in OCaml, ... native format in Mathematica, and a major hassle in Fortran). ...
    (sci.math.num-analysis)
  • Re: Very poor Lisp performance / about Mathematica
    ... >> You cannot predict what such an OCaml program will do. ... Not using them is considered an abuse of the language. ... I wouldn't apply any of that theory to Mathematica directly. ...
    (comp.lang.lisp)
  • Re: RAD vs. performance
    ... compilers do nothing to optimise such code. ... maybe the OCaml people should improve their compiler:) ... OCaml code is not usually written in that form, ... ordinary variants are commonly used. ...
    (comp.lang.misc)
  • Re: CL failure stories?
    ... Mathematica version also does this. ... That's vastly better than the original Lisp code! ... In SML and OCaml you would write eval yourself. ... - fun eval state = fn ...
    (comp.lang.lisp)