petehunt / node-jsx

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

Increase performance by checking for @jsx comment before compiling. #22

Open niondir opened 10 years ago

niondir commented 10 years ago

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.

zertosh commented 10 years ago

@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

niondir commented 10 years ago

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".

mweibel commented 9 years ago

:+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.

niondir commented 9 years ago

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.