{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/812","labels_url":"https://api.github.com/repos/facebook/react/issues/812/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/812/comments","events_url":"https://api.github.com/repos/facebook/react/issues/812/events","html_url":"https://github.com/facebook/react/issues/812","id":25057513,"number":812,"title":"Server rendering is slower with npm react","user":{"login":"plievone","id":134936,"avatar_url":"https://avatars.githubusercontent.com/u/134936?v=3","gravatar_id":"","url":"https://api.github.com/users/plievone","html_url":"https://github.com/plievone","followers_url":"https://api.github.com/users/plievone/followers","following_url":"https://api.github.com/users/plievone/following{/other_user}","gists_url":"https://api.github.com/users/plievone/gists{/gist_id}","starred_url":"https://api.github.com/users/plievone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plievone/subscriptions","organizations_url":"https://api.github.com/users/plievone/orgs","repos_url":"https://api.github.com/users/plievone/repos","events_url":"https://api.github.com/users/plievone/events{/privacy}","received_events_url":"https://api.github.com/users/plievone/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react/labels/Component:%20Build%20&%20Tooling","name":"Component: Build & Tooling","color":"5319e7"}],"state":"closed","locked":false,"assignee":{"login":"zpao","id":8445,"avatar_url":"https://avatars.githubusercontent.com/u/8445?v=3","gravatar_id":"","url":"https://api.github.com/users/zpao","html_url":"https://github.com/zpao","followers_url":"https://api.github.com/users/zpao/followers","following_url":"https://api.github.com/users/zpao/following{/other_user}","gists_url":"https://api.github.com/users/zpao/gists{/gist_id}","starred_url":"https://api.github.com/users/zpao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpao/subscriptions","organizations_url":"https://api.github.com/users/zpao/orgs","repos_url":"https://api.github.com/users/zpao/repos","events_url":"https://api.github.com/users/zpao/events{/privacy}","received_events_url":"https://api.github.com/users/zpao/received_events","type":"User","site_admin":false},"milestone":null,"comments":21,"created_at":"2014-01-04T18:09:15Z","updated_at":"2015-12-02T00:49:10Z","closed_at":"2015-04-01T22:49:21Z","body":"I ran a few benchmarks on the server (modifying https://github.com/paulshen/react-bench to not use jsdom). The results were surprising, as the browserified `react.js` was about **30% faster** than the npm version, even with `NODE_ENV=production`.\r\n\r\nThe performance ranking (test run time) was `react.min.js` < `react.js` < `NODE_ENV=production node react` < `node react`.\r\n\r\nI suspect `process.env` is not a regular js object but perhaps a getter and thus carries a penalty when you test for `\"production\" !== process.env.NODE_ENV` everywhere. \r\n\r\nAlso the minified version might still perform best of all, as at least some time ago V8 used function source length (including comments) as a heuristic for function complexity / compilation time and thus affecting chances for optimization in some cases, but the effect might be negligible."},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/161143942","html_url":"https://github.com/facebook/react/issues/812#issuecomment-161143942","issue_url":"https://api.github.com/repos/facebook/react/issues/812","id":161143942,"user":{"login":"STRML","id":1197375,"avatar_url":"https://avatars.githubusercontent.com/u/1197375?v=3","gravatar_id":"","url":"https://api.github.com/users/STRML","html_url":"https://github.com/STRML","followers_url":"https://api.github.com/users/STRML/followers","following_url":"https://api.github.com/users/STRML/following{/other_user}","gists_url":"https://api.github.com/users/STRML/gists{/gist_id}","starred_url":"https://api.github.com/users/STRML/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STRML/subscriptions","organizations_url":"https://api.github.com/users/STRML/orgs","repos_url":"https://api.github.com/users/STRML/repos","events_url":"https://api.github.com/users/STRML/events{/privacy}","received_events_url":"https://api.github.com/users/STRML/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T00:49:09Z","updated_at":"2015-12-02T00:49:09Z","body":"@taitsmp Technically, you have to [enable processing on node_modules](https://babeljs.io/docs/usage/require/) (which is slow) to get this to work. \r\n\r\n@zpao How do you feel about `__DEV__` compiling not into `\"production\" !== process.env.NODE_ENV\"` in non-dist builds, but rather require() some module that caches the env? I believe this will optimize well - if you could point me to where to look, I can profile it and work out the kinks."}}