THE SPEED OF SML/NJ


Terms and conditions for using and even looking at this homepage
Homepage index | Programming | 3D Graphics | Music | My CV | WebLinks

The speed of SML/NJ

As a programmer I am very concerned about the execution speed of the software that I write. This is becuase that I don't like that a lot of software today tend to get increasingly slower as computers get faster. When prgramming in a language like Standard ML, the software is supposed to have very few bugs becuase of the typesafety of the language. While I think this is an extremely Good Thing (TM), I still don't think it is worth it, if the execution speed decreases too much. This is the reason that I have made 2 tests on the performance of Standard ML. My tests are done with SML/NJ, becuase this is a very complete SML system which is free and comes with sourcecode. I compared the performance with 2 similar tests in Objective-C which I had created earlier. It was compiled with GNU Objective-C with the -O2 option and compiled for the Pentium CPU in my computer. The Objective-C code doesn't have many method-calls (Objective-C messages), it's mostly ANSI-C. I ported from Objective-C to SML, not vice versa, and even implemented the SML version using the same code structure as the Objective-C version to be realistic. I believe that the SML version can be done more efficiently when taking full advantage of the features in SML.

The SML tests executed between half as fast and as fast as the Objective-C version, except for sin/cos calls. I discovered that the sin/cos functions in SML/NJ are quite inefficient compared to those in the GNU-C compiler.

I also tried to alter the first test to allocate and free the matrix object for each vertex. This showed me that allocating/freeing modules in SML/NJ is a lot faster than allocating/freeing objects in Objective-C.

SML compilers seems to be getting more efficient all the time as new compiler technologies are invented. With this in mind and with the above test results, I think I'm ready to start using SML for serious work.

Links to SML compilers




- ÁNOQ of the Sun


Modified: 1999-04-14
E-mail:anoq@HardcoreProcessing.com