Yaron Naveh
Yaron Naveh

Reputation: 24406

node.js native extension vs. pure js module

I'm writing a new node.js component. I write it from scratch - no existing assets to reuse. What are some of the considerations for building a native extension vs. a pure js module?

Upvotes: 3

Views: 408

Answers (1)

Alfred
Alfred

Reputation: 61773

You should try to write pure js modules. First they are a lot easier to write and maintain. Second they are cross-platform. Third, which I think is also pretty important you will probably have no memory leaks when you write your extensions in pure javascript.

When you have finished the pure javascript implementation and the performance is desired/OK I don't think you should write native extension. Only try this when the performance is subpar.

Also I believe they are changing the complete infrastructure to write native extension and will use gyp instead?

Upvotes: 2

Related Questions