petehunt / node-jsx

transparently require() jsx from within node
164 stars 32 forks source link

node-jsx in production #19

Open nickdima opened 10 years ago

nickdima commented 10 years ago

Is it a good idea to use node-jsx in production or better to pre-compile the files?

petehunt commented 10 years ago

Shouldn't make a difference

Sent from my iPhone

On Oct 3, 2014, at 10:50 AM, Nick Dima notifications@github.com wrote:

Is it a good idea to use node-jsx in production or better to pre-compile the files?

— Reply to this email directly or view it on GitHub.

tomaskikutis commented 9 years ago

@petehunt are you sure ? https://github.com/petehunt/node-jsx/issues?utf8=%E2%9C%93&q=performance

Are there any benchmarks to compare performance of precompiled vs node-jsx ?

jjmasse commented 9 years ago

@tomaskikutis So how this works is the install method bootstraps a callback to how Require treats .js files ( or whatever extension you provide in options ).

When @petehunt says "it shouldn't" - it really shouldn't since everything in the require chain should be in memory when your server is primed.

Hypothetically, if you create methods that use require outside of setting initial dependencies, you incur a performance hit since the files are transpiled through jstransform.transform(...) as part of the require process.

Depending on how you architect your application, you could end up running ..transform more often than you would like.

More on require.extensions:

require.extensions