node-jsx icon indicating copy to clipboard operation
node-jsx copied to clipboard

Increase performance by checking for @jsx comment before compiling.

Open niondir opened this issue 11 years ago • 4 comments

It saves me some seconds if I only pass files with the @jsx header to React.transform. All other files have no need to be transformed.

niondir avatar Oct 19 '14 16:10 niondir

@Niondir: /** @jsx React.DOM */ is going away in React 0.12 http://facebook.github.io/react/blog/2014/10/16/react-v0.12-rc1.html#the-jsx-pragma-is-gone

zertosh avatar Oct 21 '14 14:10 zertosh

Good point. A better solution for may problem would be to defined include/exclude paths from where files are pares. Currently it's filtered only based on the extension. I wan't at least exclude all node_module dirs. Or include only one subdirectory of my project like "/public".

niondir avatar Oct 24 '14 06:10 niondir

:+1: a PR might be the wrong place to discuss this, but I just had an issue with this. node-jsx injecting itself into the default .js extension loader will lead to a massive memory usage increase. I switched now to .jsx and renamed all JSX files, memory usage went from ~300MB down to ~40MB. I think there should be at least a warning in the README to prevent everyone from doing the same mistake.

mweibel avatar Jan 04 '15 13:01 mweibel

Yep, it's not only the memory usage but also the startup time. Checking for the extension is probably the best way to solve the problem. That's what I do now, too.

niondir avatar Jan 07 '15 23:01 niondir