{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-rails/issues/156","labels_url":"https://api.github.com/repos/reactjs/react-rails/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-rails/issues/156/comments","events_url":"https://api.github.com/repos/reactjs/react-rails/issues/156/events","html_url":"https://github.com/reactjs/react-rails/issues/156","id":55926605,"number":156,"title":"Server side rendering performance issues","user":{"login":"jmagoon","id":3710387,"avatar_url":"https://avatars.githubusercontent.com/u/3710387?v=3","gravatar_id":"","url":"https://api.github.com/users/jmagoon","html_url":"https://github.com/jmagoon","followers_url":"https://api.github.com/users/jmagoon/followers","following_url":"https://api.github.com/users/jmagoon/following{/other_user}","gists_url":"https://api.github.com/users/jmagoon/gists{/gist_id}","starred_url":"https://api.github.com/users/jmagoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmagoon/subscriptions","organizations_url":"https://api.github.com/users/jmagoon/orgs","repos_url":"https://api.github.com/users/jmagoon/repos","events_url":"https://api.github.com/users/jmagoon/events{/privacy}","received_events_url":"https://api.github.com/users/jmagoon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-29T17:02:57Z","updated_at":"2015-09-19T11:07:10Z","closed_at":"2015-02-19T19:12:01Z","body":"I have an application that is rendering ~5000 sub-components. When prerendering using the ExecJS prerender engine, this takes about 1.5 seconds. Without prerendering, it takes about 700ms, and doing a hybrid approach of rendering using Rails templates and then overwriting with a React.render() takes about 600ms.\r\n\r\nProfiling the ExecJS server side rendering, I get the following:\r\n```\r\n%self      total      self      wait     child     calls  name\r\n 57.33      0.877     0.877     0.000     0.000        2   V8::C::Script#Run\r\n  4.00      0.250     0.061     0.000     0.189    11148   Hash#each\r\n  2.37      0.036     0.036     0.000     0.000    55764   Module#===\r\n  2.31      0.092     0.035     0.000     0.057    22313  *Class#new\r\n  2.16      0.120     0.033     0.000     0.087    11148   ActiveSupport::JSON::Encoding::JSONGemEncoder::EscapedString#to_json\r\n  2.03      0.068     0.031     0.000     0.037    11148   String#to_json_with_active_support_encoder\r\n  1.87      0.170     0.029     0.000     0.142        1   JSON::Ext::Generator::State#generate\r\n  1.41      0.052     0.022     0.000     0.030    16725   Kernel#dup\r\n  1.39      0.132     0.021     0.000     0.111     5574   Hash#as_json\r\n  1.36      0.030     0.021     0.000     0.009    11148   JSON::Ext::Generator:\r\n```\r\n\r\nSwitching the JSON renderer to Oj improves performance slightly and increases the percentage of the V8 script call.\r\n\r\nCurious if anyone else experiences the same thing, or maybe there's an issue with my rubyracer's libv8 compilation? It doesn't make much sense to me that the JS execution would be consistently so much slower.\r\n"},"comment":{"url":"https://api.github.com/repos/reactjs/react-rails/issues/comments/141650427","html_url":"https://github.com/reactjs/react-rails/issues/156#issuecomment-141650427","issue_url":"https://api.github.com/repos/reactjs/react-rails/issues/156","id":141650427,"user":{"login":"ssaunier","id":414418,"avatar_url":"https://avatars.githubusercontent.com/u/414418?v=3","gravatar_id":"","url":"https://api.github.com/users/ssaunier","html_url":"https://github.com/ssaunier","followers_url":"https://api.github.com/users/ssaunier/followers","following_url":"https://api.github.com/users/ssaunier/following{/other_user}","gists_url":"https://api.github.com/users/ssaunier/gists{/gist_id}","starred_url":"https://api.github.com/users/ssaunier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssaunier/subscriptions","organizations_url":"https://api.github.com/users/ssaunier/orgs","repos_url":"https://api.github.com/users/ssaunier/repos","events_url":"https://api.github.com/users/ssaunier/events{/privacy}","received_events_url":"https://api.github.com/users/ssaunier/received_events","type":"User","site_admin":false},"created_at":"2015-09-19T11:07:10Z","updated_at":"2015-09-19T11:07:10Z","body":"@oelmekki Thanks for the quick reply, great material! :+1: "}}