Compiled JavaScript with NectarJS can be faster than NodeJS and C!

NectarJS KickStarter campaign is launched. The project is under development and some people doubt the efficacy of NectarJS. Here is the result of a simple Fibonacci benchmark with NodeJS, C and NectarJS.

Support NectarJS on KickStarter

The code

JavaScript Code (for NodeJS and NectarJS)

function fibonacci(n)
{
  if (n < 2)  return n;
  return fibonacci(n - 2) + fibonacci(n - 1);
}
console.log(fibonacci(45));

C code

#include <stdio.h>

int fibonacci(int n)
{
  if (n < 2) return n;
  return fibonacci(n - 2) + fibonacci(n - 1);
}

int main()
{
  printf("%d\n", fibonacci(45));
  return 0;
}

The benchmark

Results

Engine / Compiler Result
NodeJS v7.4.0 15.673s
GCC v6.3.0 3.782s
NectarJS v0.26 2.782s

So, NectarJS compiled output could be faster than C and NodeJS. We have implemented a multi-pass optimizer (called "Leeloo" :D) on JavaScript objects, that is always under active developement.

Support NectarJS on KickStarter

Adrien