Differences between SilkJS and Node.js?

460 views
Skip to first unread message

Renato Fontes

unread,
Jul 1, 2013, 3:11:24 PM7/1/13
to sil...@googlegroups.com
Well I just found out that there are more alternatives to using serverside javascript that node.js.

What are the differences between SilkJS and Node.js?

Eric Dykstra

unread,
Jul 1, 2013, 4:04:46 PM7/1/13
to sil...@googlegroups.com
Renato,

I am new to SilkJS, and have pretty much zero knowledge of Node.js. So, I can't give detailed insight. But, at a high-level, I would say that SilkJS has a much shorter learning curve, and no 'call back hell' to deal with. Further, some of the things SilkJS does, like synchronous instead of asynchronous, seems like a 'deal breaker' because it can't possibly be as good as other technologies. But, Mike has the numbers and logical reasoning to back it up. It is FAST.

As I started working more and more with SilkJS, I was expecting to hit 'road blocks' preventing me from doing things I wanted to - or at the very least - the way I wanted to. So far - I have not hit any such barriers. In fact, I now see it is designed to avoid any such barriers.

The down-side of this, is that there is no 'best practice' and therefore few examples. But, I bet if you chime in here with any issue you run into, Mike will respond quick. He has given amazing support so far - and I am looking forward to when I am able to return the favor here.

Cheers,

Eric

Michael Schwartz

unread,
Jul 1, 2013, 4:24:37 PM7/1/13
to sil...@googlegroups.com
The key difference is the synchronous nature of SilkJS.  You write your JavaScript top to bottom, left to right, as you typically do in procedure oriented languages.

You don't have to worry about starving the event loop for CPU time.  If you need to calculate fibonacci numbers, just do it.  If you need to call array.sort(), go for it. 

SilkJS uses all the cores and hyperthreads of your CPU automatically.  

SilkJS encourages you to run as much JavaScript logic as you need.  Very little was written in C++, only thin glue functions between the JS environment and the OS and library functions.  

NodeJS encourages you to spend as little time as you have to running JavaScript, or you will starve the event loop.  If you do not understand C++, there is a lot of code involved that you will not be able to hack on.

Projects I've ported from PHP to SilkJS shrink in terms of number of files and number of lines of code.  An example is 250,000 lines in 25,000 files down to 20,000 lines in 200 files.

What else do you want to know?



On Jul 1, 2013, at 12:11 PM, Renato Fontes <renato...@gmail.com> wrote:

Well I just found out that there are more alternatives to using serverside javascript that node.js.

What are the differences between SilkJS and Node.js?

--
You received this message because you are subscribed to the Google Groups "SilkJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Renato Fontes

unread,
Jul 1, 2013, 4:36:13 PM7/1/13
to sil...@googlegroups.com
Thanks for the replies... The synchronous nature of it stills scares the fuck out of me, though...

I'll give it a try anyway xD

Angel Java Lopez

unread,
Jul 1, 2013, 5:27:58 PM7/1/13
to sil...@googlegroups.com
A short comment:

AFAIK, SilkJs is not running in Windows, am I right?

Renato Fontes

unread,
Jul 1, 2013, 5:29:03 PM7/1/13
to sil...@googlegroups.com

It isn't

You received this message because you are subscribed to a topic in the Google Groups "SilkJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/silkjs/W5WcYx7Kcio/unsubscribe.
To unsubscribe from this group and all its topics, send an email to silkjs+un...@googlegroups.com.

Michael Schwartz

unread,
Jul 1, 2013, 9:44:15 PM7/1/13
to sil...@googlegroups.com
SilkJS is meant to run on debian flavored Linux, for cloud computing.

It runs on OSX because the port was easy and it is nice to have ability to develop local on your workstation.

For windows, I suggest virtual box (http://virtualbox.org) and install ubuntu in a VM to run SilkJS local.

For Renato:

As far as the synchronous nature, I'm not sure what should scare you about it.  Almost all languages are synchronous in nature.  

Consider:

SQL.startTransaction();
try {
   SQL.update('UPDATE table SET foo="bar"');
   SQL.update('UPDATE table2 SET bar="foo");
   SQL.commit(); // two related queries succeeded
}
catch (e) {
   // one or both of the queries failed
   SQL.rollback();  // rollback the transaction so the DB isn't corrupt
}

Feel free to show me the async version.

One other benefit I did not mention earlier is that SilkJS is robust.  If one process crashes/core dumps, the server continues to run (a new process is spawned to replace it).  In a single threaded server, one crash and boom, the whole thing is gone.

Regards
Reply all
Reply to author
Forward
0 new messages