Click here to Skip to main content
13,588,580 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 28 Dec 2012
Licenced CPOL

Saltarelle vs JSIL -- Raytracer Demo

, 28 Dec 2012
Rate this:
Please Sign up or sign in to vote.
In this post, I have compared the performance of Saltarelle-compiler vs. another C# to JavaScript compiler: JSIL by Kevin Gadd.

I've compared the performance of Saltarelle-compiler vs. another C# to JavaScript compiler: JSIL by Kevin Gadd.

Differently from Saltarelle, JSIL operates at intermediate language (IL) level. After the C# program is compiled by Visual Studio, JSIL examines the MSIL instruction code contained in the DLL files and translates them into JavaScript.

This allows a greater compatibility and portability of .NET applications, but probably introduces an unnecessary layer of abstraction between the original C# code and the JavaScript output.

This is shown by the following test.

I've converted the Raytracer Demo featured on the JSIL website to the Saltarelle compiler, with the aim to compare the execution speed of the two versions.

Adapting the code to Saltarelle was easy but not straightforward. Saltarelle was missing some needed System classes that I had to re-implement, namely Bitmap, Color, StopWatch, Console and Random. I tried to keep them as similar as possible to the JSIL version so to not affect the result of the test. I also had to write the import code for mersenne.js, a small library the demo uses for generating random numbers (probably because javascript's Math.random() lacks the random seed feature).

Result of the Test

I ran the test on a four core Athlon AMD processor with Windows 7 and Chrome browser. The result is summarized in the table:

  Saltarelle JSIL
Script code size (.js) 108 KB 15 MB
Average time/pixel 0.006 ms 0.093 ms

So, on average, Saltarelle is 15 times faster than JSIL. Impressive!

The output script code is also very small-sized with no loading time, while the JSIL version has to download 15 MB of stuff before it can start.

Check By Yourself

You can run the above test in your browser:

You can also download the Visual Studio solution used to build the Saltarelle version.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Antonino Porcino
Software Developer
Italy Italy
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMessage Removed Pin
5-Dec-13 5:37
memberPepLamb5-Dec-13 5:37 
QuestionShort and useful Pin
Frank Hileman29-Dec-12 7:46
memberFrank Hileman29-Dec-12 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.180615.1 | Last Updated 28 Dec 2012
Article Copyright 2012 by Antonino Porcino
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid