Review of OCaml Journal articles : Low-level optimization tips and tricks

Hi,

Jon Harrop has written many articles in his OCaml Journal, and some of them are related to low-level optimization, which is a very important topic for OCaml developers, as OCaml is a fast functional language and can race against mainstream languages if we help him with our way of writing code, using the compiler, etc.

These articles cover many aspects of optimizations, of different kind :

  • Architecture
  • Compiler manipulation (flags, etc)
  • Allocation
  • Deforesting (elimination of intermediate data structures)
  • Copies
  • Boxing
  • Mutation
  • Garbage collection
  • and so on…

As I’m often doing some “races” between OCaml and other languages (Haskell, C++, Java, …), it has been very interesting for me and I managed to write equivalent applications where OCaml was winning “the race”, together with C++, generally. I’ve been programming in C++ for 6 years now and know many optimizations-related stuffs in C++. But learning this kind of things for OCaml was very interesting but also important for me. Moreover, you know, when you like a programming language, you often want to discover its “underground”, know it just well so that you’ll exactly know what your code will generate.

With functional programming languages, however, it’s easier to have an idea of what will be generated by the compiler, but if you don’t read about such things, you’ll never be able to guess. I think as there’s not that much documentation about OCaml but the official reference manual, Jon’s work is really valuable and is (and would) be of help for many OCaml developers.

These articles have really helped me with discovering OCaml’s underground and were very useful for projects I’m working on, in OCaml of course. Why not for you ?

PS : Comments are closed. Don’t loose your time criticizing anyone. Thanks. But you can e-mail me for discussing it (same adress than on mailing lists).